I am an Android Developer

Friday, July 16, 2010

Android: Start Email-Activity with Preset Data (via Intents)

/* Create the Intent */
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

/* Fill it with Data */
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{"to@email.com"});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Text");

/* Send it off to the Activity-Chooser */
context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));

1 comment:

  1. But when i call the intent its showing message,mail, Bluetooth.

    I don't want to display message, bluetooth. How to do this?