添加了对contact类的注释

qjy
GenshinGanyu 2 years ago
parent ebb8c9e63b
commit dbf43d2653

@ -1,4 +1,4 @@
#Fri Mar 31 15:48:56 CST 2023
base.0=E\:\\AdvancedMiNotes\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex
#Fri Mar 31 16:49:37 CST 2023
base.0=D\:\\Android_projects\\app\\build\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex
renamed.0=classes.dex
path.0=classes.dex

@ -36,20 +36,23 @@ public class Contact {
+ " FROM phone_lookup"
+ " WHERE min_match = '+')";
/*
*
* Phonenumber*/
/**
*
*
*/
public static String getContact(Context context, String phoneNumber) {
if (sContactCache == null) {
sContactCache = new HashMap<String, String>();
}
// 查找HashMap中是否已有phoneNumber信息如果存在则返回phoneNumber信息
if (sContactCache.containsKey(phoneNumber)) {
return sContactCache.get(phoneNumber);
}
/*
+
*/
/**
* phoneNumber
*/
String selection = CALLER_ID_SELECTION.replace("+",
PhoneNumberUtils.toCallerIDMinMatch(phoneNumber));
Cursor cursor = context.getContentResolver().query(
@ -59,12 +62,22 @@ public class Contact {
new String[]{phoneNumber},
null);
/**
* moveToFirst()
*/
if (cursor != null && cursor.moveToFirst()) {
/**
*
*/
try {
String name = cursor.getString(0);
sContactCache.put(phoneNumber, name);
return name;
} catch (IndexOutOfBoundsException e) {
}
/**
*
*/
catch (IndexOutOfBoundsException e) {
Log.e(TAG, " Cursor get string error " + e.toString());
return null;
} finally {

Loading…
Cancel
Save