Android联系人问题
答
方法获得接触
public List<String> lookupContactNames(){
contentResolver = context.getContentResolver();
List<String> contacts = new ArrayList<String>();
Cursor cursor = null;
try {
final String[] projection = new String[] { ContactsContract.Contacts.DISPLAY_NAME };
String selection = ContactsContract.Contacts.IN_VISIBLE_GROUP
+ " = '1'";
String[] selectionArgs = null;
final String sortOrder = ContactsContract.Contacts.DISPLAY_NAME
+ " COLLATE LOCALIZED ASC";
cursor = contentResolver.query(
ContactsContract.Contacts.CONTENT_URI, projection,
selection, selectionArgs, sortOrder);
while (cursor.moveToNext()) {
contacts
.add(cursor
.getString(cursor
.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)));
}
return contacts;
} finally {
if (cursor != null) {
cursor.close();
}
}
}
从DB你只需要姓名联系? – 2012-04-23 02:20:08
可能的重复:http://stackoverflow.com/questions/9650750/how-to-get-mobile-number-form-contact&http://stackoverflow.com/questions/3476957/where-to-store-a-联系列表上-AN-的Android手机 – 2012-04-23 08:48:58