public Bitmap getBitmap(String url) { if (diskLruCache.containsKey(url)) { return diskLruCache.getBitmap(url); } else { return null; } }
public void load( ImageView imageView, String url, int defaultBackround, int width, int height, boolean isCache, final Drawable errorImage) { if (url == null || !url.contains("http://") && errorImage != null) { imageView.setImageDrawable(errorImage); } else { if (ImageCache.getInstance().get(url + width + "*" + height) != null) { imageView.setImageBitmap(ImageCache.getInstance().get(url + width + "*" + height)); } else if (diskLruCache.containsKey(url + width + "*" + height)) { imageView.setImageBitmap(diskLruCache.getBitmap(url + width + "*" + height)); } else { if (defaultBackround != 0) { imageView.setImageResource(defaultBackround); } final LoadRunnable run = new LoadRunnable( imageView, url, defaultBackround, errorImage, width, height, isCache, handler); executorServie.execute(run); // imageView.setOnClickListener(new OnClickListener() { // @Override // public void onClick(View v) { // ImageView imageView = (ImageView) v; // if (imageView.getDrawable() == null // || imageView.getDrawable() == errorImage) { // executorServie.execute(run); // } // } // }); } } }