Android, dynamically changing the view, adding/removing new components
<p>I am an android newbie so forgive me if this question is simple.</p>

<p>Basically I want to port over a java project to Android. By view components in my java application dynamically change depending on the model. I.e the model being display may require n check boxes or n radio boxes depending on the enum TYPE being passed to the view.</p>

<p>In my java display this is achieved by nested loops with the n number each time adding the component to the screen. e.g a simplified version of the code:</p>

<pre><code>if (type == TYPE.CHECKBOXES){
for (int i = 0; i &lt; n ; i++){
add(new JCheckBox()); 
}}
</code></pre>

<p>This is processed for the view each time a next button is pressed (the type changes each time). In android how do i dynamically add and remove components, or do i need to set up a new view for each type?</p>

<p>Many thanks
Sam</p>
