我正在开发一个 ANdroid 应用程序。在我的应用程序中,我必须列出所有对话,并且我做了那部分。每个对话都包含该号码的所有短信。所以我必须从所有短信中区分收件箱和发送短信。我知道以下 api 可以用来查找收件箱和发送。
content://sms/inbox
content://sms/sent
但我不想使用这个。我使用 api 列出了所有短信
content://sms/
我使用 columnindex 的类型、地址进行了测试,但它总是为收件箱和发件箱提供相同的结果。我的示例代码是
Uri SMS_INBOX = Uri.parse("content://sms");
c = getContentResolver().query(SMS_INBOX, null, "thread_id" + " = "
+ "3", null,
"date" + " ASC");
if(c.moveToFirst()){
count.add(c.getCount());
for(int j=0;j<c.getCount();j++){
System.out.println(c.getString(c.getColumnIndexOrThrow("body")).toString());
System.out.println("new person=="+c.getColumnIndex("person")+"type=="+c.getColumnIndexOrThrow("type"));
c.moveToNext();
}
}
c.close();
请帮我。