title: Spinner use IF else
body: <p>i want to take the value in spinner and user press the ok Button and then start new activity from against the value of spinner. The string array is just like that.</p>
  
  <pre><code> public class Menu extends Activity implements View.OnClickListener {
      private String[] array_spinner = {"Select Here", "Honda", "Toyota", "Mitibushi"};
      private String[] array_spinner01 = {"Select Here", "Civic", "Gli", "Lancer"};
      //    //private String[] array_spinner02={"1999","2000","2005"};
  //    Spinner s,s1,s2;
  //    Button ok;
  //@Override
  //    protected void onCreate(Bundle savedInstanceState) {
  //        super.onCreate(savedInstanceState);
      Spinner s, s1;
      Button ok;
      Object _globalString;
      Object _globalString2;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_menu);
  
          s = (Spinner) findViewById(R.id.spinner);
          ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getApplicationContext(), android.R.layout.simple_spinner_dropdown_item, array_spinner);
          s.setAdapter(adapter);
  
          s1 = (Spinner) findViewById(R.id.spinner01);
          ArrayAdapter&lt;String&gt; adapter1 = new ArrayAdapter&lt;String&gt;(getApplicationContext(), android.R.layout.simple_spinner_dropdown_item, array_spinner01);
          s1.setAdapter(adapter1);
  //
  //    s2=(Spinner)findViewById(R.id.spinner02);
  //    ArrayAdapter&lt;String&gt; adapter2=new ArrayAdapter&lt;String&gt;(getApplicationContext(),android.R.layout.simple_spinner_dropdown_item,array_spinner02);
  //    s2.setAdapter(adapter2);
  
          ok = (Button) findViewById(R.id.btn_ok);
          ok.setOnClickListener(this);
  
          s.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                      int position, long id) {
                  _globalString = parent.getItemAtPosition(position);
              }
  
              //@Override
              public void onNothingSelected(AdapterView&lt;?&gt; parent) {
                  // TODO Auto-generated method stub
  
              }
          });
  
          s1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                      int position, long id) {
                  _globalString2 = parent.getItemAtPosition(position);
              }
  
              // @Override
              public void onNothingSelected(AdapterView&lt;?&gt; parent) {
                  // TODO Auto-generated method stub
  
              }
          });
  
      }
  
      @Override
      public void onClick(View v) {
          if (v.getId() == R.id.btn_ok) {
              if (_globalString.equals("Honda") || _globalString2.equals("Civic")) {
                  startActivity(new Intent(getApplicationContext(), Civic.class));
              } else if (_globalString.equals("Toyota") || _globalString2.equals("Gli")) {
                  startActivity(new Intent(getApplicationContext(), Toyota.class));
              }
  
          }
      }
  }
  </code></pre>
  
  <p>please tell me where is my mistake in this code because i stucked and i cant find it</p>