[小代码]读取联系人名

<!-- 读取联系人权限 -->   

<uses-permission android:name="android.permission.READ_CONTACTS"/>  

Uri allContacts2 = ContactsContract.Contacts.CONTENT_URI;

	Cursor c2 = getContentResolver().query(allContacts2, null, null, null, null);
	if (c2.moveToFirst()) {
	do {
		String contactID2 = c2.getString(c2.getColumnIndex(ContactsContract.Contacts._ID));
		String contactDisplayName2 = c2	.getString(c2.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
		Log.v("Content Providers", contactID2 + ", "+ contactDisplayName2);
	   } while (c2.moveToNext());
	}

你可能感兴趣的:(android,读取,联系人名)