1
I have an application that generates a pdf from an internal content.
I need to share this pdf
, and for that, I do it as follows:
final String filePath = file.getAbsolutePath();
final Uri arquivo = Uri.parse( filePath);
final Intent _intent = new Intent();
_intent.setAction(Intent.ACTION_SEND);
_intent.putExtra(Intent.EXTRA_STREAM, arquivo);
_intent.putExtra(Intent.EXTRA_TEXT, "Meu PDF");
_intent.putExtra(Intent.EXTRA_TITLE, "Meu pdf");
_intent.setType("application/pdf");
startActivity(Intent.createChooser(_intent, "Compartilhar"));
Being the variable arquivo
one Uri
, with the file path, which is generated when opening the screen.
The Intent is called after the user’s click.
When I try to send by email, the file is not attached.
Displays a Toast saying it is not possible to attach an empty file.
But when I go to the folder, it opens normally!
How do I manage to share this pdf by email?