Send email with bitmap object as an attachment in Android?

mobiledev picture mobiledev · Jan 23, 2011 · Viewed 11.6k times · Source

I want to send the bitmap as an attachment in the mail. The image is not stored in SDCARD or anywhere in the device. The bitmap object gets created at runtime and that should be sent as an attachment.

Answer

Cristian picture Cristian · Jan 23, 2011

Then, you must save the Bitmap to the SDCard, and then attach it to the email (I guess, you know how to do so).

Why is it necessary to save it to the SDCard? That's because the email app will have to read the file that it's going to be attached; thus, you have to pass the path and filename to the email client. As any other app, the email client can only access files stored in its own private directory or the SDCard.