title: Android dependent spinners - onItemSelected does not fire
body: <p>I tryed to create two dependent spinners. I know there is more than enough of this type of question, but nothing fixed my problem. It seems <code>onItemSelected</code> does not fire at all. I want the second (townships_spinner) change when first spinner (divisions_spinner) is selected or changed. Let's say I have states and cities, when I select the state a want to display only cities from given state. Spinners are created dynamicaly.</p>
  
  <p>That's my code:</p>
  
  <pre><code>public class RegistrationActivity extends Activity implements AdapterView.OnItemSelectedListener {
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      ...
      createLayout();
    }
  
    public void createLayout(){
      division_spinner = new Spinner(this);
  
      ArrayAdapter division_adapter = new ArrayAdapter(this,R.layout.spinner,divisions.getList());
      divisions_id = viewer.getValueByKey(viewer_form.getViewers_form_viewers_inputname());
      division_spinner.setAdapter(division_adapter);
      division_spinner.setSelection(divisions.getIndex(divisions_id));
      division_spinner.setOnItemSelectedListener(this);
  
      township_spinner = new Spinner(this);
      ArrayAdapter township_adapter = new ArrayAdapter(this,R.layout.spinner,townships_map.get(divisions_id));
      if (divisions_id == null) {
        township_spinner.setEnabled(false);
      }
      String value = viewer.getValueByKey(viewer_form.getViewers_form_viewers_inputname());
      township_spinner.setSelection(townships.getIndex(value, divisions_id));
    }
  
    public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1, int arg2,long arg3) {
  
      Toast.makeText(RegistrationActivity.this, "Yes",Toast.LENGTH_LONG);
      if(arg0.equals(division_spinner)) {
          Toast.makeText(RegistrationActivity.this, "Yes - You got it!",Toast.LENGTH_LONG);
  
          township_spinner.setEnabled(true);
          ArrayAdapter township_adapter = new ArrayAdapter(this, R.layout.spinner, townships_map.get(((Division)division_spinner.getSelectedItem()).getDivisions_id().toString()));
          township_spinner.setAdapter(township_adapter);
      }
    }
  
    public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
  
    }
  }
  </code></pre>
  
  <p>But "Yes" even "Yes - you got it!" toast does not appear.</p>
  
  <p>I guess I miss something stupid, but I cant find it.</p>