CleanUtil.java
public class CleanUtil {
private CleanUtil() {
}
public static void unbindDrawables(View view) {
if (view.getBackground() != null) {
view.getBackground().setCallback(null);
view.setBackground(null);
if (view instanceof ImageView) {
((ImageView) view).setImageDrawable(null);
}
}
if (view instanceof ViewGroup && !(view instanceof AdapterView)) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
unbindDrawables(((ViewGroup) view).getChildAt(i));
}
((ViewGroup) view).removeAllViews();
}
}
}