public Uri getContactUri(String contactId, Context context) { if (context == null || contactId == null) { return null; } // Get the Uri of contact information Uri uri = ContactsContract.Contacts.CONTENT_URI; // Get ContentResolver ContentResolver contentResolver = context.getContentResolver(); // Query data, return Cursor Cursor cursor = contentResolver.query(uri, null , null , null , null ); while (cursor.moveToNext()) { // Get the contact's ID String id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); // Get the contact's name String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME) ); String lookupKey = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY)); if (id != null && id.equals(contactId)) { return ContactsContract.Contacts.getLookupUri(Integer.valueOf(contactId), lookupKey); } } return null; }