Possible Duplicate:
Android multiple email attachments using Intent
I already know there are may similar questions as I got my current code from one of the answer. But I am facing some problem and initially I think it is of gmail app but then I tried with other email client and same issue.
Code:–
ArrayList<Uri> uris = null;
try {
uris = logger.getSiteFilePaths(siteIndex);
} catch (BaseLoggerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("application/octet-stream");
emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
emailIntent.putExtra(Intent.EXTRA_EMAIL,"");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Bl\u00fc-Test Log");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Please find the attachments.");
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
startActivity(Intent.createChooser(emailIntent, "Email:"));
File paths are accurate
**e.g. --** file:///storage/sdcard0/BAPISandy_test1.csv
Issue:- In Gmail app files seems to be attached but when you send email it says “Couldn’t show attachemnt” in notification bar. If tried with other email client it doesn’t show files as attachment.
System Info:–
Samsung Galaxy Tab 2 (7 inch)
Android 4.1.1
Sorry All,
Its hard to find small bugs like missing
"/"in file path which actually causing issue.