2

我想阅读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;
4

2 回答 2

3

SMS 草稿 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"

有些已记录在案,其余的则没有/

于 2013-08-07T10:41:12.750 回答
0
   public static final Uri CONTENT_URI =
                Uri.parse("content://sms/draft");

如需更多帮助,请检查此

http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.2.2_r1/android/provider/Telephony.java

于 2013-08-07T10:44:39.140 回答