4

I am trying to launch an email intent with an attached jpg.

I did:

Intent intent4 = new Intent(Intent.ACTION_SENDTO,
Uri.fromParts("mailto", "testemail@gmail.com", null));
startActivity(intent4);

this launches the email activity.

But when I try to add DataAndType (my jpeg attachment). It fails with

android.content.ActivityNotFoundException: No Activity found to handle Intent { action=android.intent.action.SENDTO data=file:///data/data/com.mycompany.mypackage/files/temp-picture type=JPEG 


Intent intent4 = new Intent(Intent.ACTION_SENDTO,
  Uri.fromParts("mailto", "testemail@gmail.com", null));
intent4.setDataAndType(Uri.parse("file://"+ mTempFilePath),
  Bitmap.CompressFormat.JPEG.name());    
startActivity(intent4);
Lucifer
  • 29,392
  • 25
  • 90
  • 143
silverburgh
  • 8,659
  • 10
  • 31
  • 24

1 Answers1

2

Did you try setting the mime manually to "image/jpeg" instead of Bitmap.CompressFormat.JPEG.name().

jitter
  • 53,475
  • 11
  • 111
  • 124