Does anybody know how to get a list of contacts belonging to a 1 specific group in Android?
I need something like this:
Select * from contacts where group_id = "1234"
I am able to get a list of all contacts OR all groups by using something like this:
Cursor groupCursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
final ArrayList<String> contacts = new ArrayList<String>();
while(groupCursor.moveToNext()) {
String name = groupCursor.getString(groupCursor.getColumnIndex(ContactsContract.Constacts.DisplayName ));
contacts.add(name);
}
Hope this will help you to find contact According to group id.
this is what i use and it works fine for me
this requires you to have the Group id already and that can be found by querying ContactsContract.Groups
and call this function from where you want