Last active
December 22, 2015 06:58
-
-
Save seemike/6434660 to your computer and use it in GitHub Desktop.
Android: send an email. Lets the user select the email app if there is more than one
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
/** | |
* send an email. Lets the user select the email app if there is more than one | |
* @param to | |
* @param subject | |
* @param body | |
*/ | |
void email(String to, String subject, String body){ | |
//mailto url | |
to = to == null ? "" :to; | |
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" +to +"?subject=" + Uri.encode(subject) + "&body=" + Uri.encode(body))); | |
startActivity(Intent.createChooser(intent, getString(R.string.send_email))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment