2011-10-24 21 views
0

发送短信我该如何让用户发来短信:的Android由intent.createChooser

Intent intentt = new Intent(Intent.ACTION_SEND); 
intentt.setType("text/plain"); 
intentt.putExtra(Intent.EXTRA_TEXT, ""); 
intentt.putExtra("address", selecteditem_phone); 
startActivityForResult(Intent.createChooser(intentt, ""), 0); 

这带来了很多的应用程序的列表。我怎么能告诉android只提供短信功能的应用程序?

+0

对不起,我错 – erdomester

回答

2

创建你的意图是这样,而不是:

Intent intentt = new Intent(Intent.ACTION_VIEW);   
intentt.setData(Uri.parse("sms:")); 
intentt.setType("vnd.android-dir/mms-sms"); 
intentt.putExtra(Intent.EXTRA_TEXT, ""); 
intentt.putExtra("address", selecteditem_phone); 
startActivityForResult(Intent.createChooser(intentt, ""), 0); 
+0

好。这带来了一个文件浏览器和quickoffice :) – erdomester

+0

而不是intentt.setType(“text/plain”);解决方案是intentt.setType(“vnd.android-dir/mms-sms”); – erdomester

+0

这是正确的。为了达到规范的目的,我编辑了我的回复。 –

相关问题