In my app I want to swap images at runtime when user clicks on it.
there are two imageviews when user click on first image and then click on second image at the
This is a sample e.g. where i use to Free the native object associated with this bitmap
.
Bitmap bitmap;
public Bitmap createBitmap(ImageView imageview) {
if (bitmap != null) {
bitmap.recycle();
bitmap = null;
}
bitmap = Bitmap.createBitmap(imageview.getDrawingCache());
// Your Code of bitmap Follows here
}
Before use of Bitmap just free the object.
use bitmap.recycle();
before valuating your bitmaps to clear their cache before recreating it.