Code example for LruCache

Methods: evictAll, put

0
             
            return bitmap;
        } catch (Throwable ex){
           ex.printStackTrace();
           if(ex instanceof OutOfMemoryError)
               memoryCache.evictAll();
           return null; 
        } 
    } 
 
     
    //Task for the queue 
    private class PhotoToLoad 
    { 
        public String url;
        public ImageView imageView;
		public int fail;
        public PhotoToLoad(String u, ImageView i, int f){
            url=u; 
            imageView=i;
            fail = f;
        } 
    } 
     
    class PhotosLoader implements Runnable {
        PhotoToLoad photoToLoad;
        PhotosLoader(PhotoToLoad photoToLoad){
            this.photoToLoad=photoToLoad;
        } 
         
        @Override 
        public void run() { 
            try{ 
                if(imageViewReused(photoToLoad))
                    return; 
                Bitmap bmp=getBitmap(photoToLoad.url);
                memoryCache.put(photoToLoad.url, bmp);
                if(imageViewReused(photoToLoad))
                    return; 
                BitmapDisplayer bd=new BitmapDisplayer(bmp, photoToLoad);
                handler.post(bd);
            }catch(Throwable th){