Skip to content

Instantly share code, notes, and snippets.

@dingbuoyi
Created December 19, 2016 04:23
Show Gist options
  • Save dingbuoyi/29a518dd2496f887b7fd3a1ae0b6502f to your computer and use it in GitHub Desktop.
Save dingbuoyi/29a518dd2496f887b7fd3a1ae0b6502f to your computer and use it in GitHub Desktop.
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("message/rfc822");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, emailSubject);
emailIntent.putExtra(Intent.EXTRA_TEXT, emailContent);
if (emailIntent.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(Intent.createChooser(emailIntent, "Send email ..."));
} else {
if (emailClientNotInstalledCallback != null) {
emailClientNotInstalledCallback.handle();
} else {
Logger.e("no email client installed ! ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment