0

I have successfully created the PDF file, which is stored in Internal Storage/app_name/files/xyz.pdf Now, I just want to share that pdf in the attachment in Gmail...... Updated: Getting Error in Debugger "Source Code does not match the byte Code"

Here is the code:     
File filelocation = new 
File("/storage/emulated/0/Android/data/com.example.app_name/files/s.pdf");
Uri path = Uri.fromFile(filelocation); 
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent .setType("vnd.android.cursor.dir/email");
String to[] = {"asd@gmail.com"};
emailIntent .putExtra(Intent.EXTRA_EMAIL, to);
emailIntent .putExtra(Intent.EXTRA_STREAM, path);
emailIntent .putExtra(Intent.EXTRA_SUBJECT, "Subject");
startActivity(Intent.createChooser(emailIntent , "Send email..."));

getting Exception file:///storage/emulated/0/storage/emulated/0/Android/data/com.example.app_name/files/s.pdf exposed beyond app through ClipData.Item.getUri()

Shoaib
  • 1
  • 1
  • 1
    If you created the pdf file yourself you should know the full path of the file i think as you would have told where to store the file. Please explain all in your post. Not in a comment.. – blackapps Aug 29 '20 at 12:35
  • i found the path now, but the problem is, when i am attaching the file with gmail. gmail is showing "unable to attach the file" – Shoaib Aug 30 '20 at 09:03
  • Why dont you tell us full path ? You were asked to do so. Tell the path. And post your code as we have no idea what you are doing. – blackapps Aug 30 '20 at 09:45
  • https://drive.google.com/file/d/1C7kY281mANBEIfqMM7JFcIFg3HVWlN6W/view getting this error – Shoaib Aug 30 '20 at 13:23
  • Repeat: `Why dont you tell us full path ? You were asked to do so. Tell the path. And post your code as we have no idea what you are doing. ` – blackapps Aug 30 '20 at 13:28

0 Answers0