recycle Bitmap from ImageView - Android Graphics

Android examples for Graphics:Bitmap Recycle

Description

recycle Bitmap from ImageView

Demo Code


//package com.java2s;

import android.graphics.Bitmap;

import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;

import android.widget.ImageView;

public class Main {
    public static void recycleBitmap(ImageView iv) {
        Drawable d = iv.getDrawable();/*from  www . j  a  va 2  s.  c  o m*/
        if (d instanceof BitmapDrawable) {
            Bitmap b = ((BitmapDrawable) d).getBitmap();
            b.recycle();
        }

        d.setCallback(null);
    }
}

Related Tutorials