title: Android - Spinner not able to select items
body: <p>I have a problem with my spinner. I add the items on the spinner dinamically, from a edittext when a button it's pressed. The items are correctly shown when the spinner is pressed, but no selection can be done and there's no display on the spinner.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>    final ArrayList&lt;String&gt; players = new ArrayList&lt;String&gt;();
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt; (this, android.R.layout.simple_spinner_dropdown_item, players); 
      final Spinner spinnerplayers = (Spinner)findViewById(R.id.spinnerplayers);
  
      final ImageButton addbutton = (ImageButton)findViewById(R.id.addbutton);
      final EditText editname = (EditText)findViewById(R.id.editname);
      final EditText editnum = (EditText)findViewById(R.id.editnum);
      addbutton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View arg0) {
              players.add(editname.getText().toString()+ " " + editnum.getText().toString());
              editname.setText("");
              editnum.setText("");
          }
      });
  
      spinnerplayers.setAdapter(adapter);
  
      final ImageButton removebutton = (ImageButton)findViewById(R.id.removebutton);
      removebutton.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View arg0) {
              //players.remove(spinnerplayers.getSelectedItem().toString());
          }
      });
  </code></pre>
  
  <p>If it's needed, the spinner xml is:</p>
  
  <pre><code>&lt;Spinner
          android:id="@+id/spinnerplayers"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_weight="1" /&gt;
  </code></pre>
  
  <p>Any idea about where's the problem?</p>
  
  <p>Thanks in advance.</p>