public List<String> getFullContactName(){
List<String> name = new List<String>();
String[] projection = new String[] {Data.DATA2, Data.DATA3};
String where = Data.MIMETYPE + "='" + StructuredName.CONTENT_ITEM_TYPE + "'";
Uri uri = Data.CONTENT_URI;
ContentResolver contentResolver = context.getContentResolver();
// Make the query.
Cursor cursor = contentResolver.query(uri,
projection, // Which columns to return
where, // Which rows to return
null, // Selection arguments (none)
// Put the results in ascending order by name
null);
String firstName, LastName;
while (cursor.moveToNext()) {
firstName = cursor.getString(cursor.getColumnIndex(Data.DATA2));
lastName = cursor.getString(cursor.getColumnIndex(Data.DATA3));
name.add(firstName + " " + lastName);
}
cursor.close();
cursor = null;
return name;
}
見http://stackoverflow.com/questions/2356084/read-all-contacts-phone-numbers-in-android – justderb