title: how to get android spinner value and store data in intent?
body: <p>How to get value from the spinner array..and passing the value to next page using the intent. THis is my spinner and string.xml. Please give me some advise. Thank you</p>
  
  <p>//spinner list</p>
  
  <pre><code> private String foodorder;
  
   public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.search);
  
  Spinner spinner = (Spinner) findViewById(R.id.spinner1);
          ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(
                  this, **R.array.food_array**, android.R.layout.simple_spinner_item);
          adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          spinner.setAdapter(adapter);   
          spinner.setOnItemSelectedListener(foodList);
  
  Button search_btn = (Button)findViewById(R.id.search_button);
          search_btn.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
              Intent it = new Intent();
              it.setClass(searchfood.this, search_displayResult.class);
  
              Bundle bundle = new Bundle();
              bundle.putString("KEY_DEPARTURE", ); //what should i put here?
  
  
              }
          });
  
  }
      private Spinner.OnItemSelectedListener foodList = new Spinner.OnItemSelectedListener () {
               public void onItemSelected(AdapterView parent, View v, int position,long id) {
                   foodorder = parent.getSelectedItem().toString();
               }
               public void onNothingSelected(AdapterView parent) {
  
               }
       };
  </code></pre>
  
  <p>String.xml</p>
  
  <pre><code>&lt;string name="food_prompt"&gt;Choose a food&lt;/string&gt;
      &lt;string-array name="food_array"&gt;   
          &lt;item&gt;Fish Burger&lt;/item&gt;
          &lt;item&gt;French Fried&lt;/item&gt;
          &lt;item&gt;Beef Burger&lt;/item&gt;
          &lt;item&gt;Chicken Burger&lt;/item&gt;
          &lt;item&gt;Salad&lt;/item&gt;
  
      &lt;/string-array&gt;
  </code></pre>