Example #1
0
  /**
   * Get the Bitmap according to the uri. If it is not loaded, it try to load first.
   *
   * @param uri
   * @return
   */
  public Bitmap getBitmap(String uri) {

    // if (DEBUG) {
    // cacheLog(TAG, mIdCache + " * Requesting: " + uri);
    // }
    if (uri == null) {
      return null;
    }

    Bitmap btm = mBitmapContainer.get(uri);

    if (btm == null || btm.isRecycled()) {
      if (btm != null) {
        mBitmapContainer.remove(uri);
      }

      btm = loadBitmap(uri);
    }

    return btm;
  }
Example #2
0
 public synchronized void removeBitmap(String uri) {
   mBitmapContainer.remove(uri);
   mLoadingResources.remove(uri);
 }