Reputation: 3539
i am querying contacts through
private Cursor cursor;
private static final String SORT_ORDER = ContactsContract.Contacts.DISPLAY_NAME + " ASC ";
String[] myProjection = new String[] { ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.Contacts.PHOTO_ID,
ContactsContract.Contacts.HAS_PHONE_NUMBER,
ContactsContract.Contacts.STARRED};
cursor = managedQuery(ContactsContract.Contacts.CONTENT_URI, myProjection, null, null, SORT_ORDER);
and its giving me all contacts details.But my issue is with the duplicate contact details. Like i am getting a few contacts details multiple times. i think one is from my phone contact another is from facebook contact and from other sites as well.How can i show only one contact of same person in my details.
i have read in some blogs stating a different projection like
ContactsContract.Contacts.Data.RAW_CONTACT_ID
and different URI
RawContacts.CONTENT_URI
Can anyone suggest me what is the diff between the two URI.i need to query id,name,photo,phone number,email,starred.
Thanks
Upvotes: 1
Views: 815
Reputation: 1934
To understand the difference you can follow this page: http://developer.android.com/reference/android/provider/ContactsContract.Intents.Insert.html
In nutshell:
A contact (identified by CONTACT_ID) is a virtual, combined contact. This is what the 2.0 Contacts app shows, where you might have information pulled from two different Google accounts /and/ your Facebook account.
A given contact contains one or more 'raw contacts' (identified by RAW_CONTACT_ID), which are the actual individual records from the different accounts.
Hope this clears your confusion.
Upvotes: 1