Skip to content

Instantly share code, notes, and snippets.

@cketti
Created January 7, 2016 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cketti/6a9b67dd92540bc74b2e to your computer and use it in GitHub Desktop.
Save cketti/6a9b67dd92540bc74b2e to your computer and use it in GitHub Desktop.
Create and launch ACTION_SENDTO Intent
String mailto = "mailto:bob@example.org" +
"?cc=" + "alice@example.com" +
"&subject=" + Uri.encode(subject) +
"&body=" + Uri.encode(bodyText);
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse(mailto));
try {
startActivity(emailIntent);
} catch (ActivityNotFoundException e) {
//TODO: Handle case where no email app is available
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment