Android - Opening the email application?
Try This :
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data = Uri.parse("mailto:"
+ "[email protected]"
+ "?subject=" + "Feedback" + "&body=" + "");
intent.setData(data);
startActivity(intent);
Prefer to use constants if available like for intent.type ClipDescription.MIMETYPE_TEXT_PLAIN
Kotlin:
val intent = Intent(Intent.ACTION_SEND)
intent.type = ClipDescription.MIMETYPE_TEXT_PLAIN
intent.putExtra(Intent.EXTRA_EMAIL, arrayOf("emailId 1", "emailId 2"))
intent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Subject for email")
intent.putExtra(android.content.Intent.EXTRA_TEXT, "Description for email")
startActivity(Intent.createChooser(intent,"Send Email"))
Java:
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType(ClipDescription.MIMETYPE_TEXT_PLAIN);
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{"emailId 1", "emailId 2"});
intent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Subject for email");
intent.putExtra(android.content.Intent.EXTRA_TEXT, "Description for email");
startActivity(Intent.createChooser(intent,"Send Email"));