Code example for SoftReference

0
                protected boolean removeEldestEntry( 
                        LinkedHashMap.Entry<URL, Bitmap> eldest) {
                    // Moves the last used item in the hard cache to the soft 
                    // cache. 
                    if (size() > mMaxCapacity) {
                        mSoftCache.put(eldest.getKey(),
                                new SoftReference<Bitmap>(eldest.getValue()));
                        return true; 
                    } else 
                        return false; 
                } 
            }; 
        } 
 
        public void clear() { 
            mHardCache.clear();
            mSoftCache.clear();
        } 
 
        public Bitmap get(final URL url) {
            synchronized (mHardCache) {