Android 2.0的联系人组操纵 [英] Android 2.0 contact groups manipulation
问题描述
我会操纵机器人2.O.的联络小组我的code为以下内容:
I would manipulate the contact groups in Android 2.O. My code is following:
要获取组的列表(带ID和标题):
To get a list of group (with id and title):
final String[] GROUP_PROJECTION = new String[] { ContactsContract.Groups._ID, ContactsContract.Groups.TITLE };
Cursor cursor = ctx.managedQuery(ContactsContract.Groups.CONTENT_URI, GROUP_PROJECTION, null, null, ContactsContract.Groups.TITLE + " ASC");
后来,在一个ListView中,我选择一个组(onClick事件),并阅读所有的联系人都属于这个组选定按照code:
Later, on an ListView, I select a group (onClick event) and read all contacts belong to this selected group by following code:
String where = ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID
+ "="
+ groupid
+ " AND "
+ ContactsContract.CommonDataKinds.GroupMembership.MIMETYPE
+ "='"
+ ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE
+ "'";
问题:ContactsContract.Groups._ID在第一个查询不与ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID在第二查询匹配
Problem: ContactsContract.Groups._ID in the first query does not match with the ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID in the second query.
任何解决方案/建议?
感谢
推荐答案
我做了很多与接触小组,并作为我记得那些code片段起来还有从我的其他职位。在code确实为我工作,并应为你工作了。
I worked a lot with Contact Groups, and as I remember those code fragments up there are from my other posts. The code does work for me, and should work for you too.
我不明白为什么这两个数据不应该匹配。请仔细检查一遍。
I don't see why the two data should not match. Please double check again.
这篇关于Android 2.0的联系人组操纵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!