title: Spinner setOnItemSelectedListener doesn't call onItemSelected
body: <p>In the last few days I tried to insert some spinner inside some cells of a table where the headers on the top and on the left are fix and only the other cells are scrollable as a unit. To implement this I found <a href="https://github.com/InQBarna/TableFixHeaders" rel="nofollow">InQBarna/TableFixHeaders</a> and changed the SampleTableAdapter.java to show spinner in some of the cells (not inside the header). </p>
  
  <p>To work with the made selections of the spinners I added as usual an OnItemSelectedListener for every spinner with the following code:</p>
  
  <pre><code>    final Spinner aufgabe = (Spinner) view.findViewById(android.R.id.custom);
      ArrayAdapter&lt;CharSequence&gt; adapter = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_item, ArbeitAnzeigen.allePunkte.get(column - 2));
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      aufgabe.setAdapter(adapter);
  
      aufgabe.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView parent, View view, int position, long id) {
              Log.d(TAG,"onItemSelected()");
          }
  
          @Override
          public void onNothingSelected(AdapterView parent) {
              Log.d(TAG,"onNothingSelected()");
          }
      });
  </code></pre>
  
  <p>But all of the OnItemSelectedListener don't work. They're called once the views are created, but there's no reaction, when one item (not only the preselected) of the spinners is selected.</p>
  
  <p>Here are some information to the context of my app: The table with the spinner is placed inside a fragment. This fragment is part of an other fragment with tabhost. My app has a navigation drawer to select the wanted fragment. And the mainactivity is of the type ActionBarActivity.</p>
  
  <p>I checked many variants of the code above, but I found no solution. Is there someone, who can help me? I would be happy about a hint, where I can search for and try. </p>
  
  <p>Is it possible that another listener is getting the event? When this can be, how can I find out, which one?</p>
  
  <p>Here's the whole code:</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>public class MainActivity extends Activity {
  
  public static String[] tabellenueberschrift;
  public static String[][] tabellenzeilen;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      TextView ueberschrift = (TextView) findViewById(R.id.ueberschrift);
      ueberschrift.setText("Beispieltabelle");
  
      tabellenueberschrift = new String[6];
      for (int i = 0; i &lt; 6; i++) {
          tabellenueberschrift[i] = "Header " + Integer.toString(i);
      }
  
      tabellenzeilen = new String[3][6];
      for (int i = 0; i &lt; 3; i++) {
          tabellenzeilen[i][0] = "Zeile " + Integer.toString(i);
          for (int j = 1; j &lt; 6; j++) {
              tabellenzeilen[i][j] = "3";
          }
      }
  
      TableFixHeaders tableFixHeaders = (TableFixHeaders) findViewById(R.id.table);
      tableFixHeaders.setAdapter(new TableTestAdapter(this));
  }
  </code></pre>
  
  <p><strong>TableTestAdapter.java:</strong></p>
  
  <pre><code>public class TableTestAdapter extends SampleTableAdapter {
  
  private static final String TAG = TableTestAdapter.class.getSimpleName();
  
  private final static int WIDTH_DIP = 110;
  private final static int HEIGHT_DIP = 48;
  
  private final int width;
  private final int height;
  public TableTestAdapter(Context context) {
      super(context);
      Resources resources = context.getResources();
      width = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, WIDTH_DIP, resources.getDisplayMetrics()));
      height = Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, HEIGHT_DIP, resources.getDisplayMetrics()));
  }
  @Override
  public int getRowCount() {
      return 3;
  }
  @Override
  public int getColumnCount() {
      return 5;
  }
  @Override
  public int getWidth(int column) {
      return width;
  }
  @Override
  public int getHeight(int row) {
      return height;
  }
  @Override
  public String getCellString(int row, int column) {
      if (row == -1) {
          return MainActivity.tabellenueberschrift[column + 1];
      }
      else {
          return MainActivity.tabellenzeilen[row][column + 1];
      }
  }
  @Override
  public int getLayoutResource(int row, int column) {
      final int layoutResource;
      switch (getItemViewType(row, column)) {
          case 0:
              layoutResource = R.layout.tabelle_header;
              break;
          case 1:
              layoutResource = R.layout.tabelle;
              break;
          case 2:
              layoutResource = R.layout.tabelle_spinner;
              break;
          default:
              throw new RuntimeException("wtf?");
      }
      return layoutResource;
  }
  @Override
  public int getItemViewType(int row, int column) {
      if (row &lt; 0) {
          return 0;
      } else {
          if (column &gt;= 0) {
              return 2;
          }
          else {
              return 1;
          }
      }
  }
  @Override
  public int getViewTypeCount() {
      return 3;
  }
  </code></pre>
  
  <p><strong>SampleTableAdapter.java:</strong></p>
  
  <pre><code>public abstract class SampleTableAdapter extends BaseTableAdapter {
  private static final String TAG = SampleTableAdapter.class.getSimpleName();
  private final Context context;
  private final LayoutInflater inflater;
  /**
   * Constructor
   *
   * @param context
   * The current context.
   */
  public SampleTableAdapter(Context context) {
      this.context = context;
      inflater = LayoutInflater.from(context);
  }
  /**
   * Returns the context associated with this array adapter. The context is
   * used to create views from the resource passed to the constructor.
   *
   * @return The Context associated with this adapter.
   */
  public Context getContext() {
      return context;
  }
  /**
   * Quick access to the LayoutInflater instance that this Adapter retreived
   * from its Context.
   *
   * @return The shared LayoutInflater.
   */
  public LayoutInflater getInflater() {
      return inflater;
  }
  @Override
  public View getView(int row, int column, View converView, ViewGroup parent) {
      if (converView == null) {
          converView = inflater.inflate(getLayoutResource(row, column), parent, false);
      }
      if (getItemViewType(row, column) == 2) {
          final Spinner spinner = (Spinner) converView.findViewById(android.R.id.custom);
  
          ArrayAdapter&lt;CharSequence&gt; adapter = new ArrayAdapter(getContext(), android.R.layout.simple_spinner_item, getItems(Integer.valueOf(MainActivity.tabellenzeilen[row][column + 1])));
          adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          spinner.setAdapter(adapter);
  
          spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
              @Override
              public void onItemSelected(AdapterView parent, View view, int position, long id) {
                  Log.d(TAG, "onItemSelected()");
              }
  
              @Override
              public void onNothingSelected(AdapterView parent) {
                  Log.d(TAG, "onNothingSelected()");
              }
          });
  
      }
      else {
          setText(converView, getCellString(row, column));
      }
      return converView;
  }
  /**
   * Sets the text to the view.
   *
   * @param view
   * @param text
   */
  private void setText(View view, String text) {
      ((TextView) view.findViewById(android.R.id.text1)).setText(text);
  }
  /**
   * @param row
   * the title of the row of this header. If the column is -1
   * returns the title of the row header.
   * @param column
   * the title of the column of this header. If the column is -1
   * returns the title of the column header.
   * @return the string for the cell [row, column]
   */
  public abstract String getCellString(int row, int column);
  public abstract int getLayoutResource(int row, int column);
  
  private ArrayList&lt;String&gt; getItems(int anzahl) {
      ArrayList&lt;String&gt; rueckgabe = new ArrayList&lt;String&gt;();
  
      for (int i = 0; i &lt; anzahl; i++) {
          rueckgabe.add("Auswahl " + Integer.toString(i+1));
      }
  
      return rueckgabe;
  }
  </code></pre>