如何隐藏未接来电以在Android中阅读? [英] How to mask missed calls to read in Android?
本文介绍了如何隐藏未接来电以在Android中阅读?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下应用程序来显示未接来电:
I am working to an Android app that displays the missed calls using:
String[] projection = new String[]{
CallLog.Calls.NUMBER,
CallLog.Calls.TYPE,
CallLog.Calls.DURATION,
CallLog.Calls.CACHED_NAME,
CallLog.Calls._ID
};
String where = CallLog.Calls.TYPE + "=" + CallLog.Calls.MISSED_TYPE + " AND " + CallLog.Calls.NEW + "=1" ;
Cursor c = context.getContentResolver().query(
CallLog.Calls.CONTENT_URI,
projection,
where,
null,
null
);
c.moveToFirst();
if (c.getCount() > 0) newCountersObj.missedCallCounter = c.getCount();
在我的android listview中检查未接来电后,我想将其标记为在android DB中为已读。我该怎么做?
After checking the missed calls in my android listview I want to mark them as read in android DB. How can I do that?
问题更新,带有以下链接:
清除android.database.SQLite中的未接来电错误
推荐答案
通过将 is_read
标记设置为true。参考: http://developer.android.com/reference/android /provider/CallLog.Calls.html#IS_READ
By setting is_read
flag to true. Reference: http://developer.android.com/reference/android/provider/CallLog.Calls.html#IS_READ
示例(来自 ClearMissedCallsService ):
// Clear the list of new missed calls.
ContentValues values = new ContentValues();
values.put(Calls.NEW, 0);
values.put(Calls.IS_READ, 1);
StringBuilder where = new StringBuilder();
where.append(Calls.NEW);
where.append(" = 1 AND ");
where.append(Calls.TYPE);
where.append(" = ?");
context.getContentResolver().update(Calls.CONTENT_URI, values, where.toString(),
new String[]{ Integer.toString(Calls.MISSED_TYPE) });
这篇关于如何隐藏未接来电以在Android中阅读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文