How to get Spinner value?

Sam Dutton picture Sam Dutton · Dec 22, 2009 · Viewed 363.9k times · Source

In Android, I am trying to get the selected Spinner value with a listener.

What is the best way to get the spinner's value?

Answer

dodo picture dodo · Sep 20, 2011
Spinner mySpinner = (Spinner) findViewById(R.id.your_spinner);
String text = mySpinner.getSelectedItem().toString();