Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.widget.ImageView; public class Main { public static void clearImageView(ImageView imageView) { if (!(imageView.getDrawable() instanceof BitmapDrawable)) { return; } Bitmap drawable = ((BitmapDrawable) imageView.getDrawable()).getBitmap(); if (drawable != null && !drawable.isRecycled()) { drawable.recycle(); } imageView.setImageDrawable(null); } }