0

I am just use the code how to direct open Gmail mail composer in android? Problem is that after sending the mail. A dialog box is open that show options of "Mail, Gmail, Bluetooth" I just want to avoid it. Do you have any suggestion?

Community
  • 1
  • 1
Arslan Anwar
  • 18,746
  • 19
  • 76
  • 105

1 Answers1

0

I send e-mails with the following method. When it's called it opens a dialog that allows the user to edit the body and hit send. After sending the dialog is gone.

private void SendErrorMail( Context _context, String ErrorContent )
{
    Intent sendIntent = new Intent(Intent.ACTION_SEND);
    String subject = _context.getResources().getString( R.string.CrashReport_MailSubject );
    String body = _context.getResources().getString( R.string.CrashReport_MailBody ) +
    "\n\n"+
    ErrorContent+
    "\n\n";
    sendIntent.putExtra(Intent.EXTRA_EMAIL, getEmailAddressees());
    sendIntent.putExtra(Intent.EXTRA_TEXT, body);
    sendIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
    sendIntent.setType("message/rfc822");
    _context.startActivity( Intent.createChooser(sendIntent, "Title:") );
}
Bill Mote
  • 12,644
  • 7
  • 58
  • 82