Android examples for User Interface:View Parent
remove View from Parent
//package com.java2s; import android.view.View; import android.view.ViewGroup; public class Main { public static void removeView(View view) { if (view != null) { ViewGroup parent = getParent(view); if (parent != null) { parent.removeView(view); }/*from w w w. jav a 2s .c om*/ } } public static ViewGroup getParent(View view) { return (ViewGroup) view.getParent(); } }