在Android中获取收藏夹联系人
|
我正在尝试在Android联系人的“收藏夹”列表中获取所有联系人。目前,我可以获得所有组ID,包括收藏的组ID。但是似乎没有联系人具有该组ID作为收藏组ID。
我正在尝试获取每个组中的所有组ID和联系人。打印两个列表后,我发现收藏夹的组ID不在联系人列表中
ArrayList<String> favGroupId=new ArrayList<String>();
final String[] GROUP_PROJECTION = new String[] {
ContactsContract.Groups._ID, ContactsContract.Groups.TITLE };
Cursor cursor = getContentResolver().query(
ContactsContract.Groups.CONTENT_URI, GROUP_PROJECTION, null,
null, ContactsContract.Groups.TITLE);
while (cursor.moveToNext()) {
String id = cursor.getString(cursor
.getColumnIndex(ContactsContract.Groups._ID));
Log.v(\"Test\",id);
String gTitle = (cursor.getString(cursor
.getColumnIndex(ContactsContract.Groups.TITLE)));
Log.v(\"Test\",gTitle);
if (gTitle.contains(\"Favorite_\")) {
gTitle = \"Favorites\";
favGroupId.add(id);
}
}
cursor.close();
没有找到相关结果
已邀请:
3 个回复
凸晴
这将返回显示在Android上默认“联系人”应用程序的“收藏夹”标签中的所有联系人的列表。
吠强祷豪硅
膏焦凑