Created
September 3, 2018 12:32
-
-
Save shubhamnikam/57ddd9a5d97d1f1d07514c5ae2ba1931 to your computer and use it in GitHub Desktop.
Implicit Intent - Email
This file contains hidden or 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
intentEmail.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
Intent intent = new Intent(Intent.ACTION_SENDTO); | |
intent.setType("text/plain"); | |
intent.setData(Uri.parse("mailto:")); | |
String[] email = new String[]{"[email protected]"}; | |
String subject = "Email Subject"; | |
String text = "Email text"; | |
intent.putExtra(Intent.EXTRA_EMAIL, email); | |
intent.putExtra(Intent.EXTRA_SUBJECT, subject); | |
intent.putExtra(Intent.EXTRA_TEXT, text); | |
if (intent.resolveActivity(getPackageManager()) != null) { | |
startActivity(Intent.createChooser(intent, "Mail Using :")); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment