Vihang Patel February 2016

How to get contacts from contact list in Android? using Contact Provider

I had to fetch contact list from android using contact provider, but it was showing me duplicate entries. So, How can I filter those duplicate entries.

For example, ABCD - 123467890, 1234567890, 1234567890

how to filter duplicate phone number using contact Provider?

And Can I fetch only phone memory contact list?

Answers


Karthik Kumar February 2016

It is obvious to get duplicate contacts when you fetch them. Since, same contact (same number, different name or different number, same name) might be stored in either in google contacts, phone contacts or in sim contacts.

In order to eliminate duplicates in your application, use local database (SQLite provided by android) and make phone number as unique, no duplicates will be stored.

For more information refer this post How to get all android contacts but without those which are on SIM

Following Dalma Racz comment, will also lead you to the solution.

Post Status

Asked in February 2016
Viewed 1,575 times
Voted 12
Answered 1 times

Search




Leave an answer