Wednesday, October 7, 2009

How to send a Email Attachment or MMS in Android








The following lines of code are used to send a image as either mail attachment
or as MMS from the android mobile programatcally!

Intent sendIntent = new Intent(Intent.ACTION_SEND);
//Mime type of the attachment (or) u can use sendIntent.setType("*/*")
sendIntent.setType("image/jpeg");
//Subject for the message or Email
sendIntent.putExtra(Intent.EXTRA_SUBJECT, "My Picture");
//Full Path to the attachment
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://sdcard/test.png"));
//Use a chooser to decide whether email or mms
startActivity(Intent.createChooser(sendIntent, "Email:"));

About The Author

Katharnavas is the Web, Mobile Application Developer and also a blogger at Katharnavas Designer's Shine. Follow Katharnavas on Twitter for updates, development.

2 comments:

  1. what if you want to get the pic/audio attached as mms...without choosing from chooser list

    Vikrant

    ReplyDelete
  2. Hi Katharnavas,
    Thanx for such help.

    Apart from it do you have any idea about "How can get email inbox" in application.

    pls reply

    ReplyDelete