Android Open Source - Android-Lib-AsyncImageLoader Bitmap Cache






From Project

Back to project page Android-Lib-AsyncImageLoader.

License

The source code is released under:

Apache License

If you think the Android project Android-Lib-AsyncImageLoader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package android.lib.asyncimageloader;
//w w  w  .j  a v a  2  s.  co  m
import java.lang.ref.SoftReference;

import android.graphics.Bitmap;
import android.support.v4.util.LruCache;

final class BitmapCache extends LruCache<String, SoftReference<Bitmap>> {
    public BitmapCache(final int maxSize) {
        super(maxSize);
    }

    @Override
    protected void entryRemoved(final boolean evicted, final String key, final SoftReference<Bitmap> oldValue, final SoftReference<Bitmap> newValue) {
        if (oldValue != null) {
            final Bitmap bitmap = oldValue.get();

            if (bitmap != null) {
                if (!oldValue.get().isRecycled()) {
                    oldValue.get().recycle();
                }
            }
        }
    }
}




Java Source Code List

android.lib.asyncimageloader.AsyncImageLoader.java
android.lib.asyncimageloader.BitmapCache.java
android.lib.asyncimageloader.DiskCache.java
android.lib.asyncimageloader.GalleryAdapter.java
android.lib.asyncimageloader.OnImageLoadedListener.java
android.lib.asyncimageloader.PauseOnScroll.java
android.lib.asyncimageloader.UpdateImageView.java
android.lib.asyncimageloader.WorkItem.java