Check out example codes for "android studio clear views of layout". It will help you in understanding the concepts better.

Code Example 1

//either this
layout.removeAllViews();

//or this
((LinearLayout) findViewById(R.id.layout)).removeAllViews();

Learn ReactJs, React Native from akashmittal.com