Skip to content

Instantly share code, notes, and snippets.

@talosdev
Last active April 1, 2016 16:50
Show Gist options
  • Save talosdev/be915eb4c7c3f76f065f9b30cb332cc2 to your computer and use it in GitHub Desktop.
Save talosdev/be915eb4c7c3f76f065f9b30cb332cc2 to your computer and use it in GitHub Desktop.
Intent chooser with only email programs included. https://developer.android.com/guide/components/intents-common.html#Email
String subject = "Subject";
String destinationEmail = "example@example.com";
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:")); // only email apps should handle this
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putExtra(Intent.EXTRA_EMAIL, destinationEmail);
Intent mailer = Intent.createChooser(intent, null);
startActivity(mailer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment