How to enable button after using spinner
<p>I am creating a program that has the mainMenuButton button (created in onCreate) disabled by default.
The user first has to check a few boxes and select something from the spinner before the mainMenuButton button becomes enabled. Currently, I can't even get the button to enable after using the spinner.</p>

<p>I've tried both</p>

<pre><code> @Override
    public void onClick(View v) 
    {
     switch(v.getId())
      {

      case R.id.main_menu_button:
          openMainMenu();
          break;

      case  R.id.building_spinner:
          Button mainMenuButton=(Button)findViewById(R.id.main_menu_button); 
          mainMenuButton.setEnabled(true);
          break;
      }
    }
</code></pre>

<p>and</p>

<pre><code>    public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id)
    {
        View mainMenuButton=(View)findViewById(R.id.main_menu_button); 
        mainMenuButton.setEnabled(true);
    }
</code></pre>

<p>but to no avail. I've also tried replacing <code>View</code> with <code>Button</code>, but that didn't enable the mainMenuButton either. What exactly am I supposed to do to enable the button after something on the spinner has been selected?</p>

<p>Also, would there be much of a big difference to implement it for checkboxes as well?</p>

<p>EDIT2 : </p>

<p>If I comment out the if and else statement, the button remains permanently disabled. If I leave as is, the button is never disabled to begin with and never disables, which I don't understand because I haven't even touched the spinner, so it should be disabled by default.</p>

<pre><code>public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, long id)
{

    String buildingString = parent.getItemAtPosition(position).toString();
    if(buildingString !="Select Building")
    {
        Button mainMenuButton=(Button)findViewById(R.id.main_menu_button); 
        mainMenuButton.setEnabled(true);
    }
    else
    {
        Button mainMenuButton=(Button)findViewById(R.id.main_menu_button); 
        mainMenuButton.setEnabled(false);
    }


}
</code></pre>

<p>Im not sure if this affects it, but the spinner strings was formatted like this :</p>

<pre><code>&lt;string-array name="building_array"&gt;
        &lt;item&gt;Select Building&lt;/item&gt;
</code></pre>
