Dear all,

I'm trying to adapt my application (Personalytics) for the brand new
Android 2.0, however I'm facing an issue while accessing contacts'
phone numbers...

What I need to do is to retrieve the name associated to a stored
contact based on his/her phone number. At present I'm doing this in
two steps:
1) from a phone number I get the corresponding ID of the stored
contact (if present)
2) I retrieve the contact's name based on that ID

I managed to use the correct CONTENT_URI for reading contacts by using
reflection to be fully compatible with Android 2.0
(ContactsContract.Contacts.CONTENT_URI) and the previous versions
(People.CONTENT_URI).

Now I'm trying to do the same for Phones.CONTENT_URI (Android <= 1.6)
and ContactsContract.PhoneLookup.CONTENT_FILTER_URI (Android = 2.0)
which is needed by step 2) mentioned above. But as soon as I try to
get a contentResolver by using
ContactsContract.PhoneLookup.CONTENT_FILTER_URI I get the following
exception:

java.lang.IllegalArgumentException: Unknown URL 
content://com.android.contacts/phone_lookup

This looks really strange to me, since it should be correct (it is
part of the official API)! Moreover, I tried to look at the "API
Demos" project, in particular to the classes:

com.example.android.apis.view.List2
com.example.android.apis.view.List3

which are still using the deprecated People.CONTENT_URI and
Phones.CONTENT_URI and thus no data (i.e. contacts) is loaded (of
course I have sample contacts in the emulator).

- Do you have any suggestion to solve this problem?
- Or is there another approach I can use to get the name of a contact
based on one of his/her numbers? (This must work on all versions of
Android)

Thank you!!!!!!!! ;-)

Andrea
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to