Code example for SoftReference

Methods: get

0
	} 
 
	public void displayImage(String url, ImageView imageView, int defaultDrawableId) {
 
		if(imageMap.containsKey(url)) {
			imageView.setImageBitmap(imageMap.get(url).get());
 
		} else { 
			queueImage(url, imageView, defaultDrawableId);
			imageView.setImageResource(defaultDrawableId);
		} 
	} 
 
	private void queueImage(String url, ImageView imageView, int defaultDrawableId) {
		// This ImageView might have been used for other images, so we clear  
		// the queue of old tasks before starting. 
		imageQueue.Clean(imageView);
		ImageRef p = new ImageRef(url, imageView, defaultDrawableId);
 
		synchronized(imageQueue.imageRefs) {
			imageQueue.imageRefs.push(p);