title: Unable to check the item selected in MaterialSpinner
body: <p>I am using the Material Spinner library in an activity. I am unable to check the option/item selected by the user in the material spinner.</p>
  
  <p><a href="https://github.com/jaredrummler/MaterialSpinner" rel="nofollow noreferrer">https://github.com/jaredrummler/MaterialSpinner</a></p>
  
  <p>I followed the instructions given in the above GitHub link </p>
  
  <p>I think my problem is similar to this. <a href="https://github.com/jaredrummler/MaterialSpinner/issues/36" rel="nofollow noreferrer">https://github.com/jaredrummler/MaterialSpinner/issues/36</a></p>
  
  <pre><code>public class ChooseStateRoleName extends AppCompatActivity {
  
  List&lt;Agm_Data&gt; agm_data = new ArrayList&lt;&gt;();
  
  MaterialSpinner stateSpinner, roleSpinner, nameSpinner;
  Button nextButton;
  private int selectedState;
  private int selectedRole;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_state_role_name);
  
      String[] STATES = {"Karnataka", "Andra Pradesh","Tamil Nadu", "Kerala", "Goa", "Maharastra", "Gujarat", "Orissa", "Madhya Pradesh", "Rajastan", "Jharkand", "Bihar", "Uttar Pradesh", "West Bengal", "Haryana", "Punjab", "Assam", "Meghalaya", "Tripura"};
      String[] ROLES = {"AGM", "TGE", "DP"};
  
      final ArrayAdapter&lt;String&gt; stateAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, STATES);
      ArrayAdapter&lt;String&gt; roleAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, ROLES);
  
      stateAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      roleAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  
      stateSpinner = (MaterialSpinner) findViewById(R.id.select_state_spinner);
      roleSpinner = (MaterialSpinner) findViewById(R.id.select_role_spinner);
      nameSpinner = (MaterialSpinner) findViewById(R.id.select_name_spinner);
      nextButton = (Button) findViewById(R.id.next);
      stateSpinner.setAdapter(stateAdapter);
      roleSpinner.setAdapter(roleAdapter);
  
      stateSpinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener() {
          @Override
          public void onItemSelected(MaterialSpinner view, int position, long id, Object item) {
              selectedState = view.getSelectedIndex();
              Log.v("Selected state: ", String.valueOf(selectedState));
      });
  }
  </code></pre>
  
  <p>As soon as I select an item in the spinner, I see the logcat as shown below.
  logcat:</p>
  
  <pre><code>I/OpenGLRenderer: Initialized EGL, version 1.4
  
  W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
  
  W/InputEventReceiver: Attempted to finish an input event but the input event receiver has already been disposed.
  </code></pre>