title: Android spinner : perform item selected and and compare it to another spinner
body: <p>I'm working with 2 spinner in my app, and I want to do this operation in my button click for example like this in visual studio</p>
  
  <pre><code>if ((spin1.text = "bla bla bla") &amp;&amp; (spin2. text = "ho ho ho"))
      {
         text1.text = result;
      }
  </code></pre>
  
  <p>Do you have any idea to perform this operation in android? thanks.</p>
  
  <p>SOLVED WITH THIS CODE!!</p>
  
  <pre><code>spin1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
      {
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; parent, View seletedItem, int pos, long id)
          {
              Object item = parent.getItemAtPosition(pos);
              value1 = item.toString();
          }
  
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; parent)
          {
  
          }
      });
  
      spin2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
      {
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; parent, View selectedItem, int pos, long id)
          {
              Object item = parent.getItemAtPosition(pos);
              value2 = item.toString();
          }
  
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; parent)
          {
  
          }
      });
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.activity_main, menu);
      return true;
  }
  
  public void count(View v)
  {
      if(value1.equals("Depok") &amp;&amp; value2.equals("Jakarta"))
      {
          hasil.setText("SUCCESS");
      }
  }
  </code></pre>