views:

56

answers:

1

Hello!

As the title says, i have a Spinner with just a couple of options and a button. I didnt declared any Listener for the spinner, instead of that, what i want is use the button and perform different actions depending on the spinner selected option.

So, i declared a handler in the button option "android:onClick", but once there, i dont know how to access the option selected in the Spinner.

Can anybody help me?

Thank you!

+1  A: 

Call getSelectedItemPosition() on the Spinner. Also you may look at Spinner's reference: http://developer.android.com/reference/android/widget/Spinner.html. Click on "Exapand all" in the top right corner and search for "getselect" for other ways to get selected item info.

fhucho
Ok, thank you very much. I've been reading the spinner's reference before, but probably between all those methods i just didnt realize about the getSelectedPosition :)
Kitinz