Here id means A contact id for which you want to get contact details,
A simple code to get a phone number for a specific contact id is similar to
// Build the Uri to query to table Uri myPhoneUri = Uri.withAppendedPath( ContactsContract.CommonDataKinds.Phone.CONTENT_URI, id); // Query the table Cursor phoneCursor = managedQuery( myPhoneUri, null, null, null, null); // Get the phone numbers from the contact for (phoneCursor.moveToFirst(); !phoneCursor.isAfterLast(); phoneCursor.moveToNext()) { // Get a phone number String phoneNumber = phoneCursor.getString(phoneCursor .getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.NUMBER)); sb.append("Phone: " + phoneNumber + "\n"); } }
So, from your question, I should doubt the id parameter you are singing in your uri, just clear this. Also in my example id is a string type ...
I hope you understand this.
Update: Uri.encode(id) instead of a simple run in string format .
Thanks..
source share