Java tutorial
//package com.java2s; import java.net.URL; import java.util.HashMap; import java.util.List; import android.graphics.drawable.BitmapDrawable; public class Main { public static HashMap<URL, BitmapDrawable> sGridViewBitmapDrawableCache = new HashMap<URL, BitmapDrawable>(); public static void recycleBitmapCaches(List<URL> mList, int fromPosition, int toPosition) { // TODO Auto-generated method stub BitmapDrawable mBitmapDrawable = null; for (int del = fromPosition; del < toPosition; del++) { mBitmapDrawable = sGridViewBitmapDrawableCache.get(mList.get(del)); if (mBitmapDrawable != null && !mBitmapDrawable.getBitmap().isRecycled()) { sGridViewBitmapDrawableCache.remove(mList.get(del)); mBitmapDrawable.getBitmap().recycle(); mBitmapDrawable = null; } } } }