/** * 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没有任何反应是正常的。
* 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没有任何反应是正常的。
false的话,点击直接显示界面,速度会更快些。