Retrieve Contact Phone Number From URI in Android

I found the answer.

The reason I was not getting any rows from the cursor was because I was using the line

ContactsContract.CommonDataKinds.Phone.CONTACT_ID

“The id of the row in the Contacts table that this data belongs to.”

Since I was getting the URI from contacts table anyways — this was not needed and the following should have been substituted. The ID was the one corresponding to the contact in the phone table not the raw contact.

ContactsContract.CommonDataKinds.Phone._ID

Exchanging the lines returned the correct results in the query. Everything seems to be working well at the moment.

Leave a Comment