tags:

views:

732

answers:

1

Hi,

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

I did:

Intent intent4 = new Intent(Intent.ACTION_SENDTO,
  Uri.fromParts("mailto", "[email protected]", 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", "[email protected]", null));
intent4.setDataAndType(Uri.parse("file://"+ mTempFilePath),
  Bitmap.CompressFormat.JPEG.name());    
startActivity(intent4);
+1  A: 

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

jitter