title: Create a spinner programmatically in Android
body: <p>I want to create a spinner without using XML. I am new in android and my knowledge is limited. By now I have this code (see above) and I want my spinner in one of the tabs of my <code>TabActivity</code>.
  There is no obvious error but when I open my activity the tab is empty. I would appreciate some help.</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
  
      super.onCreate(savedInstanceState);
  
      ArrayList&lt;String&gt; spinnerArray = new ArrayList&lt;String&gt;();
      spinnerArray.add("one");
      spinnerArray.add("two");
      spinnerArray.add("three");
      spinnerArray.add("four");
      spinnerArray.add("five");
  
      Spinner spinner = new Spinner(this);
      ArrayAdapter&lt;String&gt; spinnerArrayAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_dropdown_item, spinnerArray);
      spinner.setAdapter(spinnerArrayAdapter);
  
  }
  </code></pre>