如何强制刷新上CallLog.Calls.CACHED_NAME列? [英] How to force refresh on CallLog.Calls.CACHED_NAME column?

查看:2123
本文介绍了如何强制刷新上CallLog.Calls.CACHED_NAME列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是从呼叫记录收集所有未知的电话号码。
这可以由以下code来实现:

My goal is to collect all unknown phone numbers from the Call Log. This can be achieved by the following code:

private static final String[] CALLOG_PROJECTION = {CallLog.Calls._ID,
        CallLog.Calls.CACHED_NAME, CallLog.Calls.NUMBER};
private static final String CALLOG_WHERE = CallLog.Calls.CACHED_NAME + " is null";

Cursor c = getContentResolver().query(CallLog.Calls.CONTENT_URI, CALLOG_PROJECTION,
        CALLOG_WHERE, null, CallLog.Calls.DATE + " DESC");

这工作得很好,但我已经创造了从一个不知名的号码的联系人之后,查询的结果仍然包含数目不详。

This works well, but after i've created a contact from an unknown number, the result of the query still contains the unknown number.

如果我打开通话记录活动窗,我可以看到的数字变成了几秒钟内联系人的姓名。因此,活动刷新CACHED_NAME列。

If i open the Call Log activity window, i can see as the number changes to the name of the contact within a few seconds. So, the activity refreshes the CACHED_NAME column.

我的问题是,我怎么能编程刷新(具体化)的呼叫日志?

My question is, how can i programatically refresh (actualize) the Call Log ?

推荐答案

我降落在这个问题上寻找各种方法来优化你想要做什么。而不是使用cached_name,我查询了每个数字获得的实际名称的手机内容提供商,而这导致的性能问题。

I landed on this question looking for ways to optimize what you're trying to do. Instead of using cached_name, I queried the Phone content provider for every number to get the actual name, but this led to performance issues.

我注意到,股票应用程序刷新列表的变化发生时,像你一样。

I noticed that the stock application refreshes the list when a change occurred, as you did.

我要实现在手机上表ContentObserver和更新我的名字出现这种情况的时候,如果它工作我会发布。

I'm going to implement a ContentObserver on the Phones table and update my name when that happens, I'll post if it works.

我被检查(谷歌的)<一个href=\"http://android.git.kernel.org/?p=platform/packages/apps/Contacts.git;a=blob;f=src/com/android/contacts/RecentCallsListActivity.java;h=abda32520977e0ac00eac675ad16ff9ed3906531;hb=HEAD\"相对=nofollow>联系人应用程序源$ C ​​$ C 以及他们基本上显示出与CACHED_NAME列表第一,并显示在列表中后,他们检查(在背景中)如果有到联系人的任何变化详细信息。如果有任何,他们更新CallLog记录和名单。

I was checking the (Google's) Contacts app source code and they basically show the list with the CACHED_NAME first and, after the list is displayed, they check (on the background) if there were any changes to the contacts details. If there were any, they update the CallLog record and the list.

基本上,我实现了类似的东西和它的作品。有当滚动列表,而这是检查在背景的变化,因为在一个CallLog有很多重复数的某些性能问题。所以基本上你只需要验证,如果这些数字已经被检查了。

Basically, I've implemented something similar and it works. There were some performance issues when you scrolled the list while it was checking on the background for changes, because in a CallLog there are a lot of repeated numbers. So basically you just have to verify if those numbers are already being checked out.

希望它帮助!

这篇关于如何强制刷新上CallLog.Calls.CACHED_NAME列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆