如何使用Telephony.Sms.Conversations将对话信息检索为字符串?
我试过了:
ContentResolver cr = context.getContentResolver();
Cursor convo = cr.query(Telephony.Sms.Conversations.CONTENT_URI,
new String[] { Telephony.Sms.Conversations.ADDRESS,
Telephony.Sms.Conversations.PERSON },
null,
null,
Telephony.Sms.Conversations.DEFAULT_SORT_ORDER);无论我如何得到错误的invalid column address。当我删除地址时,我得到的是invalid column person。这个类提供了什么列?(我在在线API参考页面或任何示例中都找不到任何东西。顺便说一句,我已经有一个工作代码来检索收件箱和发件箱,但我想也得到对话(我的意思是标题和邮件数量),没有匹配的收件箱和发件箱结果)
发布于 2015-01-08 10:40:30
您只能从Telephony.Sms.Conversations获取"msg_count“和"snippet”值,并且可以从Telephony.TextBasedSmsColumns获取"address“值。
private static final String[] SMS_CONVERSATIONS_PROJECTION = new String[]{"msg_count", "snippet"};
Cursor cursor = cr.query(Telephony.Sms.Conversations.CONTENT_URI,
SMS_CONVERSATIONS_PROJECTION, null, null,Telephony.Sms.Conversations.DEFAULT_SORT_ORDER);
while(cursor.moveToNext()) {
int msg_count = cursor.getInt(cursor.getColumnIndex("msg_count"));
String snippet = cursor.getString(cursor.getColumnIndex("snippet"));
}
cursor.close;没有“地址”、“日期”等等对我们来说是不方便的。
https://stackoverflow.com/questions/25685304
复制相似问题