1
我得到了一個給定組ID的聯繫人列表中得到顯示的姓名和號碼:Android 2.0的如何通過<em>ID</em>一個聯絡小組
Cursor cur = ctx.managedQuery(ContactsContract.Data.CONTENT_URI,
new String[] { GroupMembership.GROUP_ROW_ID,
GroupMembership.CONTACT_ID },
GroupMembership.GROUP_ROW_ID + "=" + String.valueOf(id),
null, null);
if (cur.moveToFirst()) {
int groupIdx = cur.getColumnIndex(GroupMembership.GROUP_ROW_ID);
int personIdx = cur.getColumnIndex(GroupMembership.CONTACT_ID);
do {
if (cur.getLong(groupIdx) == id) {
Cursor ccur = ctx.getContentResolver().query(Phone.CONTENT_URI,
new String[] {Phone.NUMBER, Phone.TYPE,
Phone.DISPLAY_NAME },
Phone.CONTACT_ID +"="+ contactId,
null, null);
Log.e("Test: Number", ccur.getString(0))
Log.e("Test: Name", ccur.getString(2))
}
} while (cur.moveToNext());
}
但似乎無法正常工作。
感謝您的快速回復。 ContactsContract.CommonDataKinds.GroupMembership.RAW_CONTACT_ID和ContactsContract.CommonDataKinds.GroupMembership.CONTACT_ID有什麼不同? – 2010-06-09 21:55:31
http://groups.google.com/group/android-developers/browse_thread/thread/77d579d60d803094 – Pentium10 2010-06-09 21:57:56