// load the bitmap from local resources indicating the size of which public static void display(Context context, int resId, ImageView imageView, int[] size) { // find the bitmap from cache first before decide to get in some way else Bitmap bitmapFromMemCache = LruCacheUtil.getBitmapFromMemCache(String.valueOf(resId)); if (bitmapFromMemCache != null) { imageView.setImageBitmap(bitmapFromMemCache); } else { BitmapWorkerTask task = new BitmapWorkerTask(context, imageView, size); task.execute(resId); } }
public static void display(Context context, String url, ImageView imageView, int[] size) { Bitmap bitmapFromMemCache = LruCacheUtil.getBitmapFromMemCache(url); if (bitmapFromMemCache != null) { imageView.setImageBitmap(bitmapFromMemCache); } else { if (cancelPotentialDownload(url, imageView)) { BitmapDownloaderTask task = new BitmapDownloaderTask(context, imageView, size); DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task); imageView.setImageDrawable(downloadedDrawable); task.execute(url); } } }