title: How to add data dynamically into the spinner from xml
body: <p>Hello I'm downloading XML and parsing data.  I want to add data to the spinner. The data updates every time I run the application. </p>
  
  <pre><code>public class Main extends ListActivity {
      TextView valueTextView;
      HashMap&lt;String, String&gt; name=null;
      private HashMap&lt;String, String&gt; array_spinner[];
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main)
          ArrayList&lt;HashMap&lt;String, String&gt;&gt;mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
          String xml = XMLfunctions.getXML();
          Document doc = XMLfunctions.XMLfromString(xml);
          NodeList nodes = doc.getElementsByTagName("Table");
          Toast.makeText(Main.this, "ID '" + nodes.getLength(),Toast.LENGTH_LONG).show();     
          for (int i = 0; i &lt; nodes.getLength(); i++) {
             HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); 
             Element e = (Element)nodes.item(i);
             map.put("id", XMLfunctions.getValue(e, "id"));
             map.put("name", "Name:" + XMLfunctions.getValue(e, "name"));
             map.put("Score", "Score: " + XMLfunctions.getValue(e, "score"));
             mylist.add(map);         
          }
  
      valueTextView = (TextView)findViewById(R.id.selected);
      Spinner s = (Spinner)findViewById(R.id.spinner);
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_spinner_item);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  }
  </code></pre>
  
  <p>Its incomplete code I don't know how to apply SpinnerAdapter Please anyone help me </p>
  
  <p>Thank you </p>
  
  <p>Abhishek</p>