I am trying to write a sample E-Mail application in Android.
My intensition is once i click on button it should open dafault mailing application with out ant chose menu.
my code is like below::
public void sendEmail(View v)
{
String[] TO = {"amrood.admin@gmail.com"};
String[] CC = {"mcmohd@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_CC, CC);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Email message goes here");
try {
//startActivity(Intent.createChooser(emailIntent, "Send mail..."));
startActivity(emailIntent);
finish();
Log.i("Finished sending email...", "");
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(MainActivity.this,
"There is no email client installed.", Toast.LENGTH_SHORT).show();
}
}
i don't need below screen: