Reputation: 6805
first of all I saw the same problem I have, solved here. But even with the answeres there, I didn't solve it. And I couldn't find a place to add comment. Only answer, and being an answer I'm not sure people will be notified with it. that's why I'm creating a new Question. Sorry for that :S
I'm new to Android world, and I'm trying basic stuff. This may seem too childish I know, but I can't figure out what the problem is. I'm trying to open one app to send an email. Wether the native app or not. I'm using a real device (Sony Ericsson Xperia X10) and I have at least two apps capable or handling email. I have the following code:
Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType("message/rfc822"); //same with "setType("text/plain")
intent.setData(Uri.parse(((EditText)findViewById(R.id.emailAddress)).getText().toString()));
thisActivity.startActivity(Intent.createChooser(intent, "Choose program"));
I'm stuck on this and it's making me crazy! I've been searching for a solution, but everybody seems to resolve this matter with the "setType
" method. This is frustrating because it's such a "small task"... :/
Thank you very much and I'm sorry for "double question".
Upvotes: 3
Views: 5166
Reputation: 1006819
You do not use setData()
here. Use EXTRA_EMAIL
. Or, use ACTION_SENDTO
instead of ACTION_SEND
, though then you will need to ensure that you have the mailto:
scheme in your Uri
.
Upvotes: 4