What I want is to hide contacts from the contact list. So to achieve this I tried a lot and searched a lot. Finally I've come to know that we can generate an invisible group and we can assign contacts to that group so that contacts will be invisible.
I tried that, but had no success. Even when I set the GROUP_VISIBLE
field of ContactsContact.Group
s, I am not able to make my group invisible.
This is what I have tried to create a invisible group:
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
ops.add(ContentProviderOperation
.newInsert(ContactsContract.Groups.CONTENT_URI)
.withValue(ContactsContract.Groups.GROUP_VISIBLE, 0)
.withValue(ContactsContract.Groups.TITLE, "InViGroup").build());
try {
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
} catch (Exception e) {
Log.e("Error", e.toString());
}
I am able to add contacts to this group but the contacts are visible in the phone book or the contact list.
My main goal is to hide the contact from contact list. Any ideas? How can I make my selected contacts invisible?