Home » Android » android – How to get only the favourite/starred contacts using ContactsContract

android – How to get only the favourite/starred contacts using ContactsContract

Posted by: admin June 15, 2020 Leave a comment

Questions:

how can I get the favourite contacts (and only the favorite / starred) contacts?

I would like to not loop through the entire contacts list checking each contact if it is starred… is there some query I can use to return only favourite/starred contacts?

thanks

How to&Answers:

You can do something like this:

Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, "starred=?",
            new String[] {"1"}, null);

where the starred=? will be your filter and "1" would suggest to pick up only favorites.