gpt4 book ai didi

android - 启动显示属于对话的所有短信线程的 UI 的 Intent 是什么?

转载 作者:行者123 更新时间:2023-11-29 22:13:44 25 4
gpt4 key购买 nike

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

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);

这启动了“创建短信”用户界面,这不是我想要的。
请注意,我有 thread_id,所以基本上我正在传递 thread_id 并尝试让它启动属于该 thread_id 的线程列表的 UI。

谢谢。

最佳答案

好的,我刚刚解决了这个问题。以下代码用于使用 thread_id 打开短信对话。我从android google groups得到的

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);

关于android - 启动显示属于对话的所有短信线程的 UI 的 Intent 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8968892/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com