我想在android的草稿盒中读取所有短信我写了一个应用程序,可以读取收件箱中的所有短信发送框 但我不知道Android中的草案盒的uri路径 我应该用收件箱替换草稿盒的uri路径来读取草稿中的所有短信 但它是什么?
sms objSms = new sms();
Uri message = Uri.parse("content://sms/sent");
ContentResolver cr = context.getContentResolver();
Cursor c = cr.query(message, null, null, null, null);
int totalSMS = c.getCount();
Log.i("READDDDDDDDD INBOX",totalSMS+"***************************" );
if (c.moveToFirst()) {
for (int i = 0; i < totalSMS; i++) {
objSms = new sms();
objSms.setPhone(c.getString(c
.getColumnIndexOrThrow("address")));
objSms.setMessage(c.getString(c.getColumnIndexOrThrow("body")));
objSms.setDate_time(c.getString(c.getColumnIndexOrThrow("date")));
ars.add(objSms);
c.moveToNext();
}
}
c.close();
return ars;
答案 0 :(得分:3)
短信草案URI
content://sms/drafts/
Uri message = Uri.parse("content://sms/drafts/");
SMS uris的完整列表是:
Inbox = "content://sms/inbox"
Failed = "content://sms/failed"
Queued = "content://sms/queued"
Sent = "content://sms/sent"
Draft = "content://sms/draft"
Outbox = "content://sms/outbox"
Undelivered = "content://sms/undelivered"
All = "content://sms/all"
Conversations = "content://sms/conversations"
"content://mms-sms/conversations"
有些文件记录在案,其余文件没有/
答案 1 :(得分:0)
public static final Uri CONTENT_URI =
Uri.parse("content://sms/draft");
获取更多帮助,请查看此