启动短信应用程序的意图 [英] launch sms application with an intent
本文介绍了启动短信应用程序的意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个关于意图的问题... 我尝试启动SMS应用程序...
I have a question about an intent... I try to launch the sms app...
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setType("vnd.android-dir/mms-sms");
int flags = Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP |
Intent.FLAG_ACTIVITY_CLEAR_TOP;
intent.setFlags(flags);
intent.setData(Uri.parse("content://sms/inbox"));
context.startActivity(intent);
所以,你可以看到,我把太多的东西在我的意图,但那是因为我不知道我该怎么办? 感谢的
so, you can see that I put too much things in my intent, but that's because I don't know how I can do... Thank's
推荐答案
要开始启动SMS活动所有你需要的是这样的:
To start launch the sms activity all you need is this:
Intent sendIntent = new Intent(Intent.ACTION_VIEW);
sendIntent.setData(Uri.parse("sms:"));
您可以添加额外填充自己的消息,这样像这样
You can add extras to populate your own message and such like this
sendIntent.putExtra("sms_body", x);
然后就startActivity的意图。
then just startActivity with the intent.
startActivity(sendIntent);
这篇关于启动短信应用程序的意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文