首先,我看到了同样的问题,在这里解决了。 但即使在那里回答,我也没解决。 我找不到添加评论的地方。 只回答,并作为答案,我不确定人们会得到通知。 这就是为什么我要创建一个新问题。 对不起:S
我是Android世界的新手,我正在尝试基本的东西。 我知道这似乎太幼稚了,但我无法弄清楚问题是什么。 我正在尝试打开一个应用程序来发送电子邮件。 是否使用本机应用程序。 我正在使用真实设备(索尼爱立信Xperia X10),我至少有两个应用程序或处理电子邮件。 我有以下代码:
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"));我坚持这个,它让我疯了! 我一直在寻找解决方案,但似乎每个人都用“ setType ”方法来解决这个问题。 这令人沮丧,因为它是一个“小任务”...:/
非常感谢,我很抱歉“双重问题”。
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".
最满意答案
你不在这里使用setData() 。 使用EXTRA_EMAIL 。 或者,使用ACTION_SENDTO而不是ACTION_SEND ,但是您需要确保在Uri拥有mailto: scheme。
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.
更多推荐
发布评论