Created
January 7, 2016 07:50
-
-
Save cketti/6a9b67dd92540bc74b2e to your computer and use it in GitHub Desktop.
Create and launch ACTION_SENDTO Intent
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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