I create a linearlayout that refes to an xml item. Inside this linearlayout i put some textview dynamically, so without taking them from the xml. Now i need to remove these textviews from the linearlayout. I tried this:
if(((LinearLayout) linearLayout.getParent()).getChildCount() > 0)
((LinearLayout) linearLayout.getParent()).removeAllViews();
but it doesn't work. How can i do? Thanks, Mattia
Why you wrote linearLayout.getParent()
you should do all this directly on LinearLayout
if(((LinearLayout) linearLayout).getChildCount() > 0)
((LinearLayout) linearLayout).removeAllViews();