Created
November 23, 2016 02:57
-
-
Save fnzainal/e2c8513e76da0849e259aa350fae3c9a to your computer and use it in GitHub Desktop.
to start gmail with extra string
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
final Intent intentGmail = new Intent(Intent.ACTION_VIEW); | |
intentGmail.setClassName("com.google.android.gm","com.google.android.gm.ComposeActivityGmail"); | |
intentGmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "user@email.com" }); | |
intentGmail.putExtra(Intent.EXTRA_SUBJECT, "SUBJECT EMAIL"); | |
intentGmail.setType("plain/text"); | |
intentGmail.putExtra(Intent.EXTRA_TEXT, "message email is here.." | |
); | |
try { | |
startActivity(intentGmail); | |
}catch (android.content.ActivityNotFoundException ex) { | |
Toast.makeText(getActivity(), getString(R.string.message_gmail_not_installed), Toast.LENGTH_SHORT).show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment