views:

348

answers:

3

Looking to create a menu toggle that switches between two possible arrays for a spinner. For example, if the spinner is set to show array A, then when I press this menu button, I want the spinner to be set to array B. If I press it again, I want it to be set back to array A.

I can handle the if/then statements and all, but how do I call the spinner's array adapter? I know how to call its value using getSelectedItemPosition(); but is there a similar method for retrieving WHICH array it is currently set to?

+1  A: 

I think AdapterView#getAdapter() is inherited by android.widget.Spinner?

Chris
Dev website says that getAdapter() returns a value of type "abstract T"What is that and how can I assign a variable to it? Sorry, I'm a bit new to Java.
Sean
A: 

What you're seeing is that AdapterView#getAdapter() is an abstract method. You want to be using AbsSpinner#getAdapter() which is where getAdapter() is actually implemented. This will return a SpinnerAdapter.

jqpubliq
A: 

I am very new to android. I want to use 2 spinners in my application, one shows the countries list, when any country is selected the other spinner should show the list of cities of that country. when city is selected some action is performed. plz help me with some sample code. thanks in anticipation

corotana