tags:

views:

33

answers:

1

Im trying to send an email in Android on 2.1 and I have two problems.

1) firstly, to To field does not populate

2) the type message/rfc822 creates an error: "no applications can perform this action"

    Intent msg = new Intent(Intent.ACTION_SEND);

    //Two types, rfc822 doesnt seem to work in the emulator
    msg.setType("text/plain");
    //msg.setType("message/rfc822");  

    //To:
    msg.putExtra(Intent.EXTRA_EMAIL, mEmailAddress);

    //Body:
    //msg.putExtra(Intent.EXTRA_TEXT, "");

    //Subject
    //msg.putExtra(Intent.EXTRA_SUBJECT, "");

    mActivity.startActivity(Intent.createChooser(msg, "chooser title"));

I am running this code sample in the emulator

Thanks Mark

A: 

To: expects a string array:

intent.putExtra(EXTRA_EMAIL, new String[] { "[email protected]" });

And it will only run on a real device.
An example.

alex
Ok, but it still doesnt show, and why wouldnt it run on an emulator?
Mark