Code example for SoftReference

Methods: get

     * Try to gets a cached image, return null if it's not cached yet. 
    synchronized public Bitmap get(String key) {
        SoftReference<Bitmap> midValue = mCache.get(key);
        if (midValue != null) {
            return midValue.get();
        return null; 
     * Caches a image with specified key. 
    synchronized public void put(String key, Bitmap value) {
        SoftReference<Bitmap> midValue = new SoftReference<Bitmap>(value);
        mCache.put(key, midValue);
Connect your IDE to all the code out there  Get Codota for Java