You’ve got a View defined in a layout file. How do you remove it from you Activity code?
ViewGroup vg = (ViewGroup)(myView.getParent()); vg.removeView(myView);
should do what you want as far as correctly removing the View from the Activity. The other guys’ answer will just make the View invisible, using up resources.
As Android mentioned in a comment:
Quoting the Android reference:
This view is invisible, and it doesn’t take any space for layout purposes.
I think it’s the best solution unless you really need to delete the object.