I implemented share code that looks like anything else found when you search on StackOverflow.
String pathToExportedFile = getPath();
// Export for share
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/jpeg");
share.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file:///" + pathToExportedFile));
share.putExtra(Intent.EXTRA_SUBJECT, "See Attachment");
model.activity.startActivity(Intent.createChooser(share, "Select a way to Share"));
However, it only works for Facebook. When I choose gmail, it looks like it is attached but when I recepient of the email gets no attachment. When I do it through Twitter, it says it cannot find the attachment.
The image file that is attached resides in "sdcard\DCIM\Camera"
Please help,
-mL
Update:
My file path is good but it looks like gmail is garbage collecting it? Here are some select ADB logs:
02-01 16:36:46.720: D/Gmail(1896): Cached file:///mnt/sdcard/DCIM/Camera/1328132065637.jpg to /data/data/com.google.android.gm/cache/2012-02-01-16:36:46428133821.attachment
02-01 16:36:46.880: D/Gmail(1896): MailProvider.insert(): added local message 140
02-01 16:36:47.100: I/Gmail(1896): MainSyncRequestProto: lowestBkwdConvoId: 0, highestHandledServerOp: 554429, normalSync: true
02-01 16:36:49.900: I/Gmail(1896): MainSyncRequestProto: lowestBkwdConvoId: 0, highestHandledServerOp: 554462, normalSync: true
02-01 16:36:51.650: D/Gmail(1896): Cleaning up cached attachment: /data/data/com.google.android.gm/cache/2012-02-01-16:36:46428133821.attachment
02-01 16:36:51.650: D/Gmail(1896): Updating message 1392647555039793989. synced=true
02-01 16:36:52.230: I/Gmail(1896): MainSyncRequestProto: lowestBkwdConvoId: 0, highestHandledServerOp: 554477, normalSync: true
Anyone got a clue?