ycomp
ycomp

Reputation: 8573

How to get only the favourite/starred contacts using ContactsContract

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

Upvotes: 8

Views: 4203

Answers (1)

V31
V31

Reputation: 7666

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.

Upvotes: 10

Related Questions