LinearLayout lp = new LinearLayout(this);
lp.addView(new Button(this));
lp.addView(new ImageButton(this));
// Now remove them
lp.removeViewAt(0); // and so on
If you have xml layout then no need to add dynamically.just call
hi if are you new in android use this way
Apply your view to make it gone
GONE is one way, else, get hold of the parent view, and remove the
child from there.....
else get the parent layout and use this method an remove all child
parentView.remove(child)
Great anwser from Sameer and Abel Terefe. However, when you remove a view, in my option, you want to remove a view with certain id. Here is how do you do that.