Code example for Map

Methods: get, put

0
  } 
 
  public static Bitmap getLocalUserContactPhoto(Context context, Uri uri) {
    if (uri == null) return getDefaultContactPhoto(context);
 
    Bitmap contactPhoto = localUserContactPhotoCache.get(uri);
 
    if (contactPhoto == null) {
      Cursor cursor = context.getContentResolver().query(uri, CONTENT_URI_PROJECTION,
                                                         null, null, null); 
 
      if (cursor != null && cursor.moveToFirst()) {
        contactPhoto = getContactPhoto(context, Uri.withAppendedPath(Contacts.CONTENT_URI,
                                       cursor.getLong(0) + ""));
      } else { 
        contactPhoto = getDefaultContactPhoto(context);
      } 
 
      localUserContactPhotoCache.put(uri, contactPhoto);
    } 
 
    return contactPhoto;
  }