I am using the following code to removes childs on every viewgroup:
protected void onDestroy() {
super.onDestroy();
this.liberarMemoria();
}
public
Verify if your ViewGroup isn't a instance of AdapterView.
Do something like that:
if (!(view instanceof AdapterView>))
((ViewGroup) view).removeAllViews();
So, on your code:
if (view instanceof ViewGroup) {
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) {
unbindDrawables(((ViewGroup) view).getChildAt(i));
}
if (!(view instanceof AdapterView>))
((ViewGroup) view).removeAllViews();
}