How to launch email intent with an attached jpg

All your problems with Audio, Video and Images.

How to launch email intent with an attached jpg

Postby n179911 » Mon Jun 29, 2009 9:01 pm

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", "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);
n179911
Freshman
Freshman
 
Posts: 2
Joined: Mon Jun 22, 2009 1:30 am

Top

Postby scuba » Fri Nov 20, 2009 8:17 pm

I'm trying to figure out how to launch the email app with the "to" pre-filled. I tried your code and when I get an "Unsupported Action" message on the screen.

Not sure what I'm doing wrong... any ideas?

Thanks!
scuba
Junior Developer
Junior Developer
 
Posts: 19
Joined: Wed Nov 11, 2009 4:19 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 14 guests