Android examples for User Interface:ViewGroup
Remove all views from ViewGroup
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static void unbindDrawables(View view) { if (view.getBackground() != null) { view.getBackground().setCallback(null); }/*from w ww. j a v a 2s. com*/ if (view instanceof ViewGroup) { for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) { unbindDrawables(((ViewGroup) view).getChildAt(i)); } ((ViewGroup) view).removeAllViews(); } } }