views:

144

answers:

1

I've searched Google for this, but have only found similar examples--not exactly what I need. I simply need to start messaging (SMS) and email intents from my app with their "to" fields already populated. So I need to send a number with the sms intent and an email address with the email intent. Any help would be appreciated.

+1  A: 

For the e-mail part :

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {"[email protected]"});

emailIntent.setType("text/plain");
startActivity(Intent.createChooser(emailIntent, "Send a mail ..."));
fedj
You might also take a look to Intent.EXTRA_SUBJECT and Intent.EXTRA_TEXT to fill the e-mail
fedj
And the same thing works with an `ACTION_SENDTO` and an `smsto:` `Uri`
CommonsWare
Thanks for the helpful responses. I noticed one thing though--when doing the SMS intent, setType() shouldn't be used because it will make the app chooser say that no apps can perform the action.
oliverwhite
Yep, setType is used to know if you want to send through E-mail, facebook, twitter, ...
fedj