Android empty Linear layout contents

AndroidAndroid Linearlayout

Android Problem Overview


H have multiple TextViews inside an LinearLayout. Now I want to delete this text view in java. The views are generated dynamically. How can I empty all contents inside this LinearLayout?

<LinearLayout android:layout_width="match_parent"
    	android:layout_height="wrap_content" android:orientation="vertical" android:id="@+id/myid">

    <TextView .../>
    <TextView .../>
    <TextView .../>

</LinearLayout>

Android Solutions


Solution 1 - Android

You can use this:

LinearLayout ll = (LinearLayout) findViewById(R.id.myid);
ll.removeAllViews();

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionManoharanView Question on Stackoverflow
Solution 1 - AndroidTed HoppView Answer on Stackoverflow