启动UI的意图是什么,它显示属于会话的所有短信线程



我想启动android UI,它显示属于一个会话的所有短信线程(具有相同的thread_id)。我尝试了不同的方法,但没有成功:

1)

Intent i =  new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("content://sms/conversations/" + thread_id));
i.addCategory(Intent.CATEGORY_DEFAULT);
startActivity(i);

我得到错误:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{android.test.intenttest2/android.test.intenttest2.IntentTest2Activity}:
    android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW cat=[android.intent.category.DEFAULT] dat=content://sms/conversations/3 }

2)

Intent i =  new Intent(Intent.ACTION_VIEW,Uri.parse("content://sms/conversations/" + thread_id));
i.setType("vnd.android-dir/mms-sms");
i.addCategory(Intent.CATEGORY_DEFAULT);
startActivity(i);

这个启动了"创建短信"UI,这不是我想要的
请注意,我随身携带thread_id,所以基本上我传递的是thread_id,并试图让它启动属于该thread_id的线程列表的UI。

谢谢。

好吧,我刚刚解决了这个问题。下面的代码使用thread_id打开一个短信会话。我从安卓谷歌集团得到的

int thread_id = 11; //the thread_id of the conversation
Intent i = new Intent(Intent.ACTION_VIEW,Uri.parse("content://mms-sms/conversations/" + thread_id));                
startActivity(i);

请尝试这个:

Intent i =  new Intent(Intent.ACTION_VIEW); 
intent.setdata("content://sms/conversations/" + thread_id);
i.setType("vnd.android-dir/mms-sms");
i.addCategory(Intent.CATEGORY_DEFAULT); 
startActivity(i); 

谢谢,

莎法利

最新更新