我做了一个 sms 应用程序。在程序中我列出所有的 convrsation。因此我使用下面的uri:
content://mms-sms/conversations/
可以正常运行,下面是代码片段:
Uri uri = Uri.parse("content://mms-sms/conversations/");
Cursor c= getContentResolver().query(uri, null, null ,null,null);
startManagingCursor(c);
if(c.moveToFirst()){
for(int i=0;i<c.getCount();i++){
body[i]= c.getString(c.getColumnIndexOrThrow("body")).toString();
number[i]=c.getString(c.getColumnIndexOrThrow("address")).toString();
c.moveToNext();
}
}
c.close();
for (int i = 0; i < body.length; i++) {
System.out.println("body ="+body[i]);
System.out.println("number ="+number[i]);
}
Number 打印的是每个 conversations 数量,body 打印的是每个conversations的最后一条信息。
我想获得每个 conversation 的整个消息还有指定的数量。如何实现?