I am developing one app, in which I am sending the email with the help of intent. I am successfully sending the mail from MainActivity, but problem is that, as I am clicking on send button for sending the email, I am going to outside of the app. But after sending the email I want to come again on MainActivity. Here is my code.
protected void sendEmail() {
String[] TO = {"xxx@gmail.com"};
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "yyyy");
emailIntent.putExtra(Intent.EXTRA_TEXT, "zzzz.");
try {
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MainActivity.this,
"There is no email client installed.", Toast.LENGTH_SHORT).show();
}
}