|
@@ -19,7 +19,7 @@ import android.util.Log;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 联系人管理,三个表 ContactsContract.Data.CONTENT_URI;
|
|
* 联系人管理,三个表 ContactsContract.Data.CONTENT_URI;
|
|
- * ContactsContract.RawContacts.CONTENT_URI
|
|
|
|
|
|
+ * ContactsContract.RawContacts.CON9TENT_URI
|
|
* ContactsContract.Contacts.CONTENT_URI
|
|
* ContactsContract.Contacts.CONTENT_URI
|
|
*
|
|
*
|
|
* @author liuyuqi
|
|
* @author liuyuqi
|
|
@@ -207,14 +207,17 @@ public class ContactManager {
|
|
Cursor cursorUser = resolver.query(uri,
|
|
Cursor cursorUser = resolver.query(uri,
|
|
new String[] { ContactsContract.CommonDataKinds.Phone._ID,
|
|
new String[] { ContactsContract.CommonDataKinds.Phone._ID,
|
|
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
|
|
ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
|
|
- ContactsContract.CommonDataKinds.Phone.RAW_CONTACT_ID },
|
|
|
|
|
|
+ ContactsContract.CommonDataKinds.Phone.RAW_CONTACT_ID,
|
|
|
|
+ ContactsContract.CommonDataKinds.Phone.NUMBER,
|
|
|
|
+ },
|
|
null, null, null);
|
|
null, null, null);
|
|
|
|
|
|
while (cursorUser.moveToNext()) {
|
|
while (cursorUser.moveToNext()) {
|
|
int id = cursorUser.getInt(0); // 按上面数组的声明顺序获取
|
|
int id = cursorUser.getInt(0); // 按上面数组的声明顺序获取
|
|
String name = cursorUser.getString(1);
|
|
String name = cursorUser.getString(1);
|
|
int rawContactsId = cursorUser.getInt(2);
|
|
int rawContactsId = cursorUser.getInt(2);
|
|
- res.add("id:" + id + " ,name:" + name + " ,rawContacntsID:" + rawContactsId + "\r\n");
|
|
|
|
|
|
+ String num = cursorUser.getString(3);
|
|
|
|
+ res.add("id:" + id + " ,name:" + name + " ,rawContacntsID:" + rawContactsId +" 手机号:"+num+ "\r\n");
|
|
}
|
|
}
|
|
return res;
|
|
return res;
|
|
}
|
|
}
|