列出群组成员(联系人)?
我可以使用下面的代码获取组列表,并将它们绑定到 ListView。它是可点击的,我可以获得该组的 NAME 和 _ID。同样,我可以获得具有类似代码的联系人列表。我无法弄清楚如何选择一个组并仅返回该组中的联系人。
我真的想以 Android 1.5 为目标。
ContentResolver cr = getContentResolver();
Cursor groupCur = cr.query(Groups.CONTENT_URI, null, null, null, null);
if (groupCur.getCount() > 0) {
while (groupCur.moveToNext()) {
...
}
}
I can get a list of groups with the code below and I've bound them to a ListView. It's clickable and I get the NAME and _ID of the group. Similarly I can get a list of contacts with similar code. What I haven't been able to figure out is how to select a group and return only the contacts in that group.
I'm really trying to target Android 1.5.
ContentResolver cr = getContentResolver();
Cursor groupCur = cr.query(Groups.CONTENT_URI, null, null, null, null);
if (groupCur.getCount() > 0) {
while (groupCur.moveToNext()) {
...
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用此处的帮助:单击 ListView 上的侦听器
我能够从单击并将其传递给 GroupMembership 以获取人员列表,最后使用 IN where 子句查询 People 以获取成员。
Using the help here: Click Listener on ListView
I was able to get a Group._ID from the click and pass that to GroupMembership to get a list of people and finally query People with an IN where clause to get the members.