首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android QuickContactBadge里面函数的作用解决办法

2013-11-11 
androidQuickContactBadge里面函数的作用assignContactFromPhone(110, false)这个函数里面的布尔值 是什

android QuickContactBadge里面函数的作用
assignContactFromPhone("110", false)
这个函数里面的布尔值 是什么作用啊?
我 试了 true 和 false  运行以后没有看出来  什么区别
[解决办法]

/**
     * Assign a contact based on a phone number. This should only be used when
     * the contact's URI is not available, as an extra query will have to be
     * performed to lookup the URI based on the phone number.
     *
     * @param phoneNumber The phone number of the contact.
     * @param lazyLookup If this is true, the lookup query will not be performed
     * until this view is clicked.
     */
    public void assignContactFromPhone(String phoneNumber, boolean lazyLookup) {
        mContactPhone = phoneNumber;
        if (!lazyLookup) {
            mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP, null,
                    Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
                    PHONE_LOOKUP_PROJECTION, null, null, null);
        } else {
            mContactUri = null;
            onContactUriChanged();
        }
    }


其实第二个参数 true和false的区别在于查询的时间点,当为true的时候,调用这个assignContactFromPhone函数不查询,直接返回一个null的mContactUri,等到用户点击QuickContactBadge控件的时候再查询;当为false的时候,调用这个函数即查询PhoneLookup.CONTENT_FILTER_URI,当点击的时候就不再查询了。
所以,楼主疑惑调用true或者false没有任何反应是正常的。

热点排行