【发布时间】:2011-07-15 05:26:32
【问题描述】:
有没有什么方法可以将给定的字符串与 android 通讯录中的名称进行比较,例如使用 ContactsContract?
【问题讨论】:
标签: android contacts addressbook android-contacts
有没有什么方法可以将给定的字符串与 android 通讯录中的名称进行比较,例如使用 ContactsContract?
【问题讨论】:
标签: android contacts addressbook android-contacts
因为您需要将字符串与每个联系人列表列表进行比较,并将此名称设置在 listArray 之类的集合之一中。这是您可以获取联系人列表名称的代码
Cursor cursor = getContentResolver().query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
new String[] { Phone._ID, Phone.DISPLAY_NAME, Phone.NUMBER },
null, null, null);
/* Cursor cursor = getContentResolver().query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
null, null, null);*/
startManagingCursor(cursor);
cursor.moveToFirst();
cursor.getColumnCount();
// // Log.i("CURSOR COLUMN IS ", ""+cursor.getColumnCount());
for (int i = 0; i < cursor.getCount(); i++) {
contactName.add(cursor.getString(1));
// // // Log.i("NAME OF LIST CONTACT", "" + cursor.getString(3));
cursor.moveToNext();
}
【讨论】: