Java tutorial
//package com.java2s; import android.graphics.drawable.BitmapDrawable; import android.widget.ImageView; public class Main { /** * Cleans up view's image to reduce memory cost to device * @param imageView */ static void cleanImageView(ImageView imageView) { if (!(imageView.getDrawable() instanceof BitmapDrawable)) return; // clean up the view's image for the sake of memory BitmapDrawable b = (BitmapDrawable) imageView.getDrawable(); b.getBitmap().recycle(); imageView.setImageDrawable(null); } }