Code example for Uri

Methods: withAppendedPath

0
                                                       null, null, null); 
 
    try { 
      if (cursor != null && cursor.moveToFirst()) {
        Uri contactUri      = Contacts.getLookupUri(cursor.getLong(2), cursor.getString(1));
        Bitmap contactPhoto = getContactPhoto(context, Uri.withAppendedPath(Contacts.CONTENT_URI,
                                                                            cursor.getLong(2)+""));
 
        return new RecipientDetails(cursor.getString(0), contactUri, contactPhoto);
      } 
    } finally { 
      if (cursor != null)
        cursor.close();
    } 
 
    return null; 
  } 
 
  private Bitmap getContactPhoto(Context context, Uri uri) {
    InputStream inputStream = ContactsContract.Contacts.openContactPhotoInputStream(context.getContentResolver(), uri);