我想删除草稿短信。我可以删除收件箱短信。如何删除草稿短信?
提前致谢。
试试下面的代码
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) {
}
}
尝试删除草稿短信
this.getContentResolver().delete(Uri.parse("content://sms/draft"),
"_id=?", new String[]{"PASS_DRAFT_SMS_ID_HERE"});