无法读取 content://sms/all
我正在开发一个需要线程短信的应用程序。我能够从收件箱检索内容,但在线程视图中短信必须同时填充收件箱和已发送的项目。
content://sms/inbox
和 content://sms/sent
分别运行良好。
如何连接两个 URI 的内容并按时间排序?
我可以使用 content://sms/all
吗?
当使用 ALL CONTENT URI 时,游标返回空值。
如何做到这一点?
I'm developing an app which requires threaded sms. I was able to retrieve contents from inbox, but in the threaded view sms must be filled with both inbox and sent items.
Separately both content://sms/inbox
and content://sms/sent
are working well.
How do I join contents from two URI's and order by time?
Can I use content://sms/all
?
Null value is returned for cursor when ALL CONTENT URI is used.
How to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
终于找到了这个问题的答案..
是我找不到的东西。
但是为了检索发送和接收的数据,我们可以使用
此代码片段按降序获取并显示
谢谢大家
At last found the answer for this..
is something which i couldnt find.
But for retrieving both sent and received we can use
This snippet fetches and displays in descending order
Thanks all
我有同样的问题。为此,您可以使用 MatrixCursor。我所做的是 -
从
content://sms/inbox
获取 thread_id 的所有短信从 thread_id 的
content://sms/sent
获取所有短信维护一个数组列表并按照你想要的顺序对它们进行排序(我使用冒泡排序来做到这一点)
现在定义并初始化matrixCursor
(请参阅:http://groups.google.com/group/android-developers/browse_thread/thread/470dd3a1703848eb/d7e70618ce413261?q=MatrixCursor+join+two+tables(用于 MatrixCursor)
添加所有排序后的记录到你的matrixCursor
(请注意,添加此记录应该按照它们出现的时间和文件夹(收件箱或已发送)的顺序。MatrixCursor 只是让您创建自定义光标,因此您需要维护顺序。)
I had the same issue. For this,you can use MatrixCursor.What I have done is-
Get all sms from
content://sms/inbox
for a thread_idGet all sms from
content://sms/sent
for a thread_idMaintain an arraylist and sort them in the order you want(I did this using bubble sort)
Now define and initialize the matrixCursor
(Refer this: http://groups.google.com/group/android-developers/browse_thread/thread/470dd3a1703848eb/d7e70618ce413261?q=MatrixCursor+join+two+tables for MatrixCursor )
Add all the sorted records to your matrixCursor
(Please note that adding this record should be in the sequence of at what time and from which folder(inbox or sent) they come.MatrixCursor simply lets you create a custom cursor so you need to maintain the sequence.)