安卓:发送邮件/短信/文件与Intent.ACTION_SEND /请求code /结果code? [英] Android: Sending a Mail/SMS/Tweet with Intent.ACTION_SEND / requestCode / resultCode?
问题描述
我用下面的code:
Intent sendMailIntent = new Intent(Intent.ACTION_SEND);
sendMailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.Share_Mail_Subject));
sendMailIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.Share_Mail_Text));
sendMailIntent.setType("text/plain");
startActivity(Intent.createChooser(sendMailIntent, "Email / SMS / Tweet ?"));
然后我想能够使之间的区别: 1.我的用户确实发送连接电子邮件/短信......或者 2.我的用户实际上已经推动了后退按钮并没有派出任何东西。
Then I would like to be able to make the difference between: 1. my user has indeed sent en email/SMS ... OR 2. my user has in fact pushed the BACK BUTTON ... and didn't send anything.
有没有一种方法,使这种差异?
Is there a way to make this difference ?
=>我应该推出与startActivityForResult的活动?并赶上请求code /结果code与onActivityResult ...
=> Should I launch the activity with startActivityForResult ? and catch the requestCode/resultCode with onActivityResult ...
=>什么结果code之王,我应该期待什么?如何正确地抓住它?我应该在哪里把code这几行?的code的任何片段将是非常有益的在这里。
=> What king of resultCode should I expect ? how to grab it correctly ? Where should I put these lines of code ? Any snippet of code would be very helpful here.
在此先感谢。
中心
推荐答案
休伯特,我试图做同样的事情。我看着彩信应用程序的ComposeActivity code,并没有看到任何调用的setResult所以我觉得它只是不这样的。
Hubert, I tried to do the same thing. I looked at the Mms app's ComposeActivity code, and don't see any calls to setResult so I think it just doesn't work that way.
这篇关于安卓:发送邮件/短信/文件与Intent.ACTION_SEND /请求code /结果code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!