Nick Betcher Nick Betcher - 1 month ago 7
Android Question

Removing All Child Views from View

How would I remove all child views from a widget? For example, I have a GridView and I dynamically inflate many other LinearLayouts into it; later in my application I am looking to start fresh with that GridView and clear all of its child Views. How would I do this? TIA.

Answer
viewGroup.removeAllViews()

works for any viewGroup. in your case it is GridView.

http://developer.android.com/reference/android/view/ViewGroup.html#removeAllViews()

Comments