title: delete view and add another one
body: <blockquote>
    <p>I need to add view to the <code>layout</code> when the user chooses something in drop down list.</p>
  </blockquote>
  
  <p>Here is my code for <code>spinner</code>,</p>
  
  <pre><code>years={"0 Years","1 Years","2 Years","3 Years","4 Years","5 Years", ... }
  spinner = (Spinner)findViewById(R.id.spinner3);
  dataAdapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_spinner_item, years);
  dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(dataAdapter);
  </code></pre>
  
  <p>Initially, the <code>layout</code> for "0 Years" will be displayed. When the user changes it, the layout related to that item should be displayed. How can I do it dynamically.I have separate <code>xml</code> files for each item.</p>