3

我想删除草稿短信。我可以删除收件箱短信。如何删除草稿短信?

提前致谢。

4

2 回答 2

1

试试下面的代码

private void deleteDrafts() {
    /*
     * This will delete all drafts from Messaging App.
     */
    try { 
        Uri uriSms = Uri.parse("content://sms/draft"); 
        Cursor c = getContentResolver().query(uriSms, new String[] { "_id", "thread_id", "address", 
                "person", "date", "body" }, null, null, null); 

        if (c != null && c.moveToFirst()) { 
            do { 
                long id = c.getLong(0); 
                getContentResolver().delete(Uri.parse("content://sms/" + id), null, null); 
            } while (c.moveToNext()); 
        } 
    } catch (Exception e) { 

    } 
}
于 2012-12-04T12:17:56.993 回答
0

尝试删除草稿短信

this.getContentResolver().delete(Uri.parse("content://sms/draft"),
                          "_id=?", new String[]{"PASS_DRAFT_SMS_ID_HERE"}); 
于 2012-12-04T11:51:46.277 回答