title: Can't resolve setOnItemSelectedListener
body: <p>My goal is to make items from spinner list to change background color of <code>main_activity</code>. </p>
  
  <p>But I can't get working <code>setOnItemSelectedListener</code> for some reason. </p>
  
  <p>Spinner works fine, toast also, but <code>setOnItemSelectedListener</code> is getting error: <strong>"cant resolve the symbol..."</strong></p>
  
  <p>Couldn't find any help online that was applicable to my case. </p>
  
  <p><strong>Please see code below:</strong></p>
  
  <pre><code>  import android.graphics.Color;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Spinner;
    import android.widget.AdapterView;
    import android.widget.TextView;
    import android.widget.Button;
    import android.widget.ToggleButton;
    import android.widget.ArrayAdapter;
    import android.widget.Toast;
    import java.util.*;
  
   public class MainActivity extends AppCompatActivity implements 
   AdapterView.OnItemSelectedListener {
  
  private TextView tekst1;
  private int ile = 1;
  private Button klawisz1;
  private ToggleButton onOff;
  private Spinner spinner1;
  
  public void setActivityBackgroundColor(int color) {
      View view = this.getWindow().getDecorView();
      view.setBackgroundColor(color);
  }
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      tekst1 = (TextView) findViewById(R.id.tekst);
      klawisz1 = (Button) findViewById(R.id.button);
      onOff = (ToggleButton) findViewById(R.id.toggleButton);
      spinner1 = (Spinner) findViewById(R.id.spinner);
  
      spinner1.setOnItemSelectedListener((AdapterView.OnItemSelectedListener) this);
      spinner1.setOnItemSelectedListener(this);
  
  
  
      List&lt;String&gt; colors = new ArrayList&lt;String&gt;();
      colors.add("White");
      colors.add("Yellow");
  
  
  
  
      ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, colors);
      dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      spinner1.setAdapter(dataAdapter);
  
      onOff.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              if ((++ile%2)==0) {
                  spinner1.setVisibility(View.VISIBLE);
              }
              else{
                  spinner1.setVisibility(View.GONE);
              }
          }
      });
  }
  spinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() 
  {
  
  public void onItemSelected(AdapterView&lt;?&gt; parent, View view, int position, 
  long id) {
      // On selecting a spinner item
      //setActivityBackgroundColor(Color.YELLOW);
      String item = parent.getItemAtPosition(position).toString();
  
      if(selectedItem.equals("White"))
      {
          setActivityBackgroundColor(Color.WHITE);
      }
      else if(selectedItem.equals("Yellow"))
      {
          setActivityBackgroundColor(Color.YELLOW);
      }
  
      // Showing selected spinner item
      //Toast.makeText(parent.getContext(), "Selected: " + item, Toast.LENGTH_LONG).show();
  }
  public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
      // TODO Auto-generated method stub
  }
  
  });
    public void buttonOnClick(View view) {
      if ((++ile%2)==0){
          tekst1.setText(new Date().toString());
          klawisz1.setBackgroundColor(Color.RED);
      }
      else
      {
          tekst1.setText("Next click - TIME");
          klawisz1.setBackgroundColor(Color.GREEN);
      }
  }
  </code></pre>