0

I have the below Controller which creates a "contact us" sort of dialog from my Android application. Everything seems to work fine except some phones include things other than email accounts in the chooser dialog. I've seen Bluetooth appear and sometimes the default Android email account even though no email account is setup on the phone. My gmail account is setup and that appears as it should. Any ideas on where I've gone wrong?

public class EmailController implements onClickListener {

    private EmailActivity emailActivity;

    public EmailController(EmailActivity eActivity){
        super();
        emailActivity = eActivity;

    }

    @Override
    public void onClick(View v){
        Intent intent = new Intent();

        switch (v.getId()) {
            case R.id.helpinfo_submit_support_reqst_btn:

                final Intent emailIntent = new Intent(
                    Intent.ACTION_SEND);
                emailIntent.setType("plain/text");
                emailIntent.putExtra(Intent.EXTRA_EMAIL,
                    new String[] { mResources
                            .getString(R.string.emailId) });
                emailIntent.putExtra(Intent.EXTRA_SUBJECT,
                    mResources.getString(R.string.emailSubject));
                emailIntent.putExtra(Intent.EXTRA_TEXT, "email body....");
                emailActivity.startActivity(Intent.createChooser(emailIntent,
                                   emailActivity.getResources().getString(R.string.info_screen_send_mail)));

                emailBody = null;  

            break;

        }

    }

}
c12
  • 9,557
  • 48
  • 157
  • 253
  • [This][1] previously submitted question and answer fixed my issue... [1]: http://stackoverflow.com/questions/8284706/send-email-via-gmail – c12 Jul 09 '12 at 17:59

1 Answers1

0

To send mail, you set type to:

...
emailIntent.setType("message/rfc822");

References:

  • that didn't clear the issue with unregistered email account appearing in the chooser. I don't have any email accounts configured on my device except for my gmail account. I get prompted by the chooser with an Email and Gmail option. When choosing the Email option, the app crashes and and takes me to a messaging screen where I get a tooltip that states "cannot find any email accounts configured on this device". Any ideas? – c12 Jul 09 '12 at 17:29