如何只删除正在处理的短信?
以下是我当前的代码:
private int deleteAllMessages(Context context){
Uri deleteUri = Uri.parse(SMS_ALL);
int count = 0;
Cursor c = context.getContentResolver().query(deleteUri, null, null, null, null);
while(c.moveToNext()){
long thread_id = c.getLong(1);
Uri thread = Uri.parse("content://sms/conversations/" + thread_id);
context.getContentResolver().delete(thread, null, null);
}
return count;
}
我想知道这个语句是什么意思:
Cursor c = context.getContentResolver().query(deleteUri, null, null, null, null);
另外,我如何更改它以仅删除特定消息(已处理)而不删除收件箱中的所有消息。
有什么帮助吗?
Below are my current codes:
private int deleteAllMessages(Context context){
Uri deleteUri = Uri.parse(SMS_ALL);
int count = 0;
Cursor c = context.getContentResolver().query(deleteUri, null, null, null, null);
while(c.moveToNext()){
long thread_id = c.getLong(1);
Uri thread = Uri.parse("content://sms/conversations/" + thread_id);
context.getContentResolver().delete(thread, null, null);
}
return count;
}
I want to know what does this statement mean:
Cursor c = context.getContentResolver().query(deleteUri, null, null, null, null);
And also, how can I change it to delete only specific message (that has been processed) and not delete all messages at inbox.
Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用以下代码从收件箱下载短信,
I use following code to download SMS from my inbox,