Java tutorial
//package com.java2s; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; public class Main { public static void unbindImageDrawables(View view) { if (null == view) { return; } if (view instanceof ImageView) { ImageView imageView = (ImageView) view; if (imageView.getDrawable() != null) { imageView.getDrawable().setCallback(null); imageView.setImageDrawable(null); } } if (view instanceof ViewGroup) { for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) { unbindImageDrawables(((ViewGroup) view).getChildAt(i)); } } } }