pull/2/head
liuyitao 1 year ago
parent 1fb45b47ad
commit 28555afe1c

@ -26,13 +26,8 @@ import android.util.Log;
import java.util.HashMap; import java.util.HashMap;
/* /*
*: *:
*/ */
/*
*
* */
public class Contact {//联系人 public class Contact {//联系人
private static HashMap<String, String> sContactCache;// sContactCache 是一个静态的 HashMap用于缓存联系人信息用于缓存联系人信息的HashMap private static HashMap<String, String> sContactCache;// sContactCache 是一个静态的 HashMap用于缓存联系人信息用于缓存联系人信息的HashMap
private static final String TAG = "Contact";// TAG 日志标签 private static final String TAG = "Contact";// TAG 日志标签
@ -45,7 +40,12 @@ public class Contact {//联系人
+ " FROM phone_lookup" + " FROM phone_lookup"
+ " WHERE min_match = '+')";// 定义查询条件的字符串 + " WHERE min_match = '+')";// 定义查询条件的字符串
public static String getContact(Context context, String phoneNumber) {//用于获取联系人信息。它接受一个上下文参数和一个电话号码参数,并返回与该电话号码对应的联系人名字 /*
*
*
*
*/
public static String getContact(Context context, String phoneNumber) {
if(sContactCache == null) {// 如果联系人缓存为空 if(sContactCache == null) {// 如果联系人缓存为空
sContactCache = new HashMap<String, String>();// 初始化联系人缓存 sContactCache = new HashMap<String, String>();// 初始化联系人缓存
} }

Loading…
Cancel
Save