Code example for ListFragment

Methods: getResources

0
 
	    final Bitmap bitmap = getBitmapFromMemCache(imageKey);
	    if (bitmap != null) {
	        mImageView.setImageBitmap(bitmap);
	    } else { 
	    	Bitmap decodedBitmap = decodeSampledBitmapFromResource(getResources(), resId, 100, 100);
	        mImageView.setImageBitmap(decodedBitmap);
	        addBitmapToMemoryCache(imageKey, decodedBitmap);
	    } 
	} 
	 
	public void addBitmapToMemoryCache(String key, Bitmap bitmap) {
		if(getBitmapFromMemCache(key) == null) {
			mMemoryCache.put(key, bitmap);
		} 
	} 
	public Bitmap getBitmapFromMemCache(String key) {
	    return mMemoryCache.get(key);
	} 
}