remove Child View - Android User Interface

Android examples for User Interface:View Child

Description

remove Child View

Demo Code


//package com.java2s;
import android.view.View;
import android.view.ViewGroup;

public class Main {

    public static void removeChildView(View view) {
        if (view == null) {
            return;
        }//from w w w.  j a va 2  s .co  m
        ViewGroup viewGroup = (ViewGroup) view.getParent();
        if (viewGroup != null) {
            viewGroup.removeView(view);
        }

    }
}

Related Tutorials