Created
May 31, 2017 05:33
-
-
Save ThrowJojo/7df69f27c2318b91f15ae8c8d09f2f60 to your computer and use it in GitHub Desktop.
Compose email intent for Android in Java.
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
public void composeEmail(String address, String subject) { | |
Intent intent = new Intent(Intent.ACTION_SENDTO); | |
intent.setData(Uri.parse("mailto:")); | |
intent.putExtra(Intent.EXTRA_EMAIL, new String[] {address}); | |
intent.putExtra(Intent.EXTRA_SUBJECT, subject); | |
if (intent.resolveActivity(getActivity().getPackageManager()) != null) { | |
getActivity().startActivity(intent); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment