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()