title: saving Spinner value to variable
body: <p>I'm having trouble wrapping my head around this bit.</p>
  
  <p>I have 2 spinners in an activity, and I need to store the selected items/values as variables, which I can then send to a database.</p>
  
  <p>my java looks like this, keep in mind that I am aware that my save() method doesn't make any sense. I just wanted to show you what I am trying to do.</p>
  
  <pre><code>    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_start_search);
  
      Spinner passengerSpinner = (Spinner)findViewById(R.id.ddlPassengers);
      ArrayAdapter&lt;CharSequence&gt; passengerAdapter = ArrayAdapter.createFromResource(this, R.array.passengerArray, android.R.layout.simple_spinner_item);
      passengerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      passengerSpinner.setAdapter(passengerAdapter);
  
      Spinner directionSpinner = (Spinner)findViewById(R.id.ddlDirection);
      ArrayAdapter&lt;CharSequence&gt; directionAdapter = ArrayAdapter.createFromResource(this, R.array.directionArray, android.R.layout.simple_spinner_item);
      directionAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      directionSpinner.setAdapter(directionAdapter);
      }
      public void save(View view){
      int passenger = passengerSpinner.getSelectedItem(); //Stored in a String array
      String direction = directionSpinner.getSelectedItem();
     }
  </code></pre>
  
  <p>I have no clue what to do to get those values stored as variables. </p>