title: Double Spinner for Android
body: <p>I'm new to this forum, but i came here because i need some help with some spinners i'm trying to create for an Android app.</p>
  
  <p>I have created 1 spinner and that works fine, but now i want to add a second spinner and i want the if statement i have to work depending on the two selections of the spinners.</p>
  
  <p>For example, if item 1 is selected on spinner 1 and item 3 is selected on spinner 2 then do the if statement.</p>
  
  <p>But i don't know how to get that to work. could anyone help me please.</p>
  
  <p>This is the code i have now for 1 spinner:</p>
  
  <pre><code>    Spinner spinner = (Spinner) findViewById(R.id.spinner1);
      ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(
                  this, R.array.weight_array, android.R.layout.simple_spinner_item);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      spinner.setAdapter(adapter);
  
      spinner.setOnItemSelectedListener(new MyOnItemSelectedListener());
  
  
  
      public class MyOnItemSelectedListener implements OnItemSelectedListener
       {
      public void onItemSelected(AdapterView&lt;?&gt; parent,
          View view, int pos, long id) 
      {
          final String itemSelected = parent.getItemAtPosition(pos).toString();
  
          if (valueEntered.getText().length() == 0)
              {
                  valueEntered.setText(String.valueOf(0));
              }
  
          if (itemSelected.equals("Stones"))
        {
              float valueInput = Float.parseFloat(valueEntered.getText().toString());
            Toast.makeText(parent.getContext(), "The scale is " +
                    parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show();
            valueEntered.setText(String.valueOf(convertSToK(valueInput)));
  
        }
  
      }
  </code></pre>
  
  <p>I really need some help, many thanks,</p>
  
  <p>Davide Sousa</p>