title: how to create dynamic Spinners in android?
body: <p>this code is working fine but its creating only one spinner dynamically i want to get value from database and want to run the loop till database values and generate dynamic Spinner inside the loop overhere i have mentioned the code of <strong>FOR LOOP</strong>  but its not working  and as well as i want to load different item in different spinner please give me idea how to do this?</p>
  
  <pre><code>public class DisciplineActivity extends Activity
      {  ArrayList&lt;String&gt; selectDisciplineArrayList,disciplineInfoArrayList;
          @Override
           protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
           setContentView(R.layout.discipline_view);
           for(int i=0;i&lt;20;i++)
      {
       disciplineInfoArrayList.add("select location item:"+i);
      }
        // for(int i=0;i&lt;5;i++)
      //{
           Spinner disciplineInfoSpinner = new Spinner(this);
           ArrayAdapter&lt;String&gt; spinnerArrayAdapter = new ArrayAdapter&lt;String&gt;(
                   this, android.R.layout.simple_spinner_item,disciplineInfoArrayList);
           spinnerArrayAdapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item );
  
           disciplineInfoSpinner = (Spinner) findViewById(R.id.disciplineinfo_spinner);
           disciplineInfoSpinner.setAdapter(spinnerArrayAdapter);
      }//
      }
  </code></pre>