Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null,
null, null, null);
List<String> numbers = null;
while (cursor.moveToNext()) {
numbers = new ArrayList<String>();
// 擷取連絡人
int nameFieldColumnIndex = cursor
.getColumnIndex(PhoneLookup.DISPLAY_NAME);
String name = cursor.getString(nameFieldColumnIndex);
// 擷取 ID
int idFieldColumnIndex = cursor
.getColumnIndex(ContactsContract.Contacts._ID);
String contactId = cursor.getString(idFieldColumnIndex);
System.out.println("contactId --- > "+contactId);
// 擷取電話號碼
Cursor phones = cr
.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "="
+ contactId, null, null);
System.out.println("phones --- > "+phones.getCount());
while (phones.moveToNext()) {
int phoneFieldColumnIndex = phones
.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
String phonenum = phones.getString(phoneFieldColumnIndex);
System.out.println("Numbers --- " + phonenum);
numbers.add(phonenum);
}