2

I generate a pdf file and want to share it. To do this I created this method:

    private void viewPdf(String file) {

    Intent share = new Intent();
    share.setAction(Intent.ACTION_SEND);
    share.setType("application/pdf");
    share.putExtra(Intent.EXTRA_STREAM, Uri.parse(file));
    share.setPackage("com.whatsapp");

    startActivity(share);
}

Unfortunately it just works if I select Whatsapp as destination. The other applications give a Toast back with the message:

Unable to attach file.

Bahman Parsa Manesh
  • 2,314
  • 3
  • 16
  • 32

0 Answers0