recycle Bitmap List - Android Graphics

Android examples for Graphics:Bitmap Recycle

Description

recycle Bitmap List

Demo Code


//package com.book2s;

import android.graphics.Bitmap;

import java.util.ArrayList;

public class Main {

    public static void recycleBitmapList(ArrayList<Bitmap> bmps) {
        if (bmps == null || bmps.size() == 0) {
            return;
        }/*from ww  w  .  j  a v a2s  .co m*/
        for (int i = 0; i < bmps.size(); i++) {
            Bitmap mBitmap = bmps.get(i);
            if (mBitmap != null && !mBitmap.isRecycled()) {
                mBitmap.recycle();
                mBitmap = null;
                System.gc();
                System.runFinalization();
                System.gc();
            }
        }
    }
}

Related Tutorials