Dynamically removing and adding views when needed
<p>I have looked at this topic to dynamically add views when needed: <a href="http://stackoverflow.com/questions/3995215/add-and-remove-views-in-android-dynamically">add and remove views in android dynamically?</a></p>

<p>However, I have a few questions.</p>

<p>1) Will there be a visible stutter or lag when creating these views on the go? For example, I use a panel system where each panel holds a separate view. However, these panels could reach a high number in quantity (40 odd panels?) when the program is complete. In order to preserve resources, I want only the view that is currently visible to actually be created, and the others views to not be instantiated until they are brought into the visible region. I have been told to use a ViewFlipper, but due to animation and user interaction requirements of my program, I cannot use a ViewFlipper, but have something along the same lines that I have created.</p>

<p>For example:</p>

<p>Imagine one of my "panels" to be pretty much like a screen in the Android Home launcher. The thing with the Home Launcher is that all it's views can be kept alive at any given time, because there's only really 7 of them. However, seeing as there are closer to 40 in mine (not all left and right, some above and below as well), I cannot have them all instantiated at the same time, or else the phone will begin to lag.</p>

<p>2) What is the code to destroy the views once they aren't in the visible region?</p>

<p>My program will determine when the panels are in the visible region or not, hence I will only need the code to destroy the views on the go.</p>

<p>Thanks.</p>
