Skip to content

Instantly share code, notes, and snippets.

@ThrowJojo
Created May 31, 2017 05:33
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 ThrowJojo/7df69f27c2318b91f15ae8c8d09f2f60 to your computer and use it in GitHub Desktop.
Save ThrowJojo/7df69f27c2318b91f15ae8c8d09f2f60 to your computer and use it in GitHub Desktop.
Compose email intent for Android in Java.
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