views:

38

answers:

1

Hello,

I am getting contact details for a given phone number using the following code:

Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNum));
Cursor cursor = context.getContentResolver().query(uri,null,null,null,null);

There is a case though when the cursor contains 3 records with the same phone number and display name.

Can you please suggest an explanation or possible reason for that?

Thanks a lot.

A: 

Are you certain that you don't have the same number entered for 3 different contacts or 3 different contact methods? You can have multiple contacts with the same numbers and manually merge them in the contacts app.

The URI you are building is a query for the contacts content provider so in the case above it is possible to return more than one contact for a given number.

Quintin Robinson
Thanks for the hint. It's the same contact with the same ID. However, when I select edit contact I see 3 Google contacts with the same phone number and display name. So I guess now the question whether it's possible to define a query that returns no duplicates.Thanks
Asahi