Example usage for android.graphics Bitmap recycle

List of usage examples for android.graphics Bitmap recycle

Introduction

In this page you can find the example usage for android.graphics Bitmap recycle.

Prototype

public void recycle() 

Source Link

Document

Free the native object associated with this bitmap, and clear the reference to the pixel data.

Usage

From source file:Main.java

public static void recycleBitmap(Bitmap bitmap) {
    if (bitmap != null && !bitmap.isRecycled()) {
        bitmap.recycle();
        bitmap = null;// w w w.ja  v a  2 s  . c om
        System.gc();
    }
}

From source file:Main.java

private static void recyleBitmap(Bitmap image) {
    try {// w  w w .j a v  a 2s.c o m
        if (image != null) {
            image.recycle();
            image = null;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

/**
 * /*from  w  ww  . j  a  va 2s  .  c o  m*/
 * @param bitmap
 */
private static void recycleBitmap(Bitmap bitmap) {
    if (bitmap != null && !bitmap.isRecycled()) {
        bitmap.recycle();
        bitmap = null;
    }
}

From source file:Main.java

public static void bitmapRecycle(Bitmap bitmap) {
    if (bitmap != null && bitmap.isRecycled() == false) {
        bitmap.recycle();
    }/* w w  w .j  ava2s . co  m*/
}

From source file:Main.java

public static void recycleSilently(Bitmap bitmap) {
    if (bitmap != null) {
        try {//from  w w w  .j  a v  a2 s.  co  m
            bitmap.recycle();
        } catch (Throwable th) {
            Log.w(TAG, "unable recycle bitmap", th);
        }
    }
}

From source file:Main.java

public static void recycleBitmap(Bitmap mBitmap) {
    if (mBitmap != null && !mBitmap.isRecycled()) {
        mBitmap.recycle();
        mBitmap = null;/*from   w  w  w  . j av a  2  s .c o  m*/
        System.gc();
        System.runFinalization();
        System.gc();
    }
}

From source file:Main.java

public static void recycleBitmap(Bitmap decodeFile) {
    if (decodeFile != null && !decodeFile.isRecycled()) {
        decodeFile.recycle();
        decodeFile = null;//from  ww  w  .  j a v a 2s .c om
        System.gc();
    }
}

From source file:Main.java

public static void recycleBitmaps(SparseArray<Bitmap> bitmapSparseArray) {
    for (int i = 0; i < bitmapSparseArray.size(); i++) {
        Bitmap mBitmap = bitmapSparseArray.get(i);
        if (mBitmap != null) {
            mBitmap.recycle();
            mBitmap = null;/* w  ww .ja v  a  2s . c  om*/
        }
    }
}

From source file:Main.java

public static void recycle(Bitmap bitmap) {
    if (null == bitmap || bitmap.isRecycled()) {
        return;/*w w w  . j  a  v  a  2  s.co  m*/
    }
    bitmap.recycle();
}

From source file:Main.java

public static void recycleBitmap(Bitmap bitmap) {
    if (bitmap == null || bitmap.isRecycled()) {
        return;//from   w w  w. jav a  2s . c  o m
    }
    bitmap.recycle();
    bitmap = null;
}