1

I declare my Spinner in the following manner (it's very static so I have 2 string arrays in array.xml for titles and values)

<Spinner android:id="@+id/searchCriteria" android:entries="@array/
searchBy" android:entryValues="@array/searchByValues">
</Spinner>

I expect spinner.getSelectedItem() to return an array [title, value] but in fact it returns just a title String. Is it ignoring android:entryValues? How do I get a value, not a title from it? Is this doable with XML only or do I need to create adapter and do it programmatically?

flag
Sorry - this is not a Android development site, only users (I didn't want to compete with StackOverflow). See stackoverflow.com for that. – Isaac Waller Oct 19 at 15:14
Sorry about that. It's not really obvious. Actually - would be really cool to be able to do it here give amount of other noise at SO – DroidIn.net Oct 19 at 17:19
@Isaac: I agree with DroidIn--it wouldn't be a bad idea to have both a users site and a development site. – Stevoni Oct 19 at 23:41
Maybe another site, but I'm busy enough with one and don't want to clutter it up with dev questions. I've been happy with StackOverflow, but if someone is willing to put in the effort to promote it, anyone can create a StackExchange site at beta.stackexchange.com . – Isaac Waller Oct 20 at 3:33

closed as off topic by Isaac Waller♦♦ Oct 19 at 15:14

1 Answer

1

Abort, abort! I don't know what got into me but Spinner does not support android:entryValues attribute. That one is actually from ListPreference which does a similar thing (displays list of items in pop-up dialog). For what I need I will have to (alas) use the SpinnerAdapter

link|flag

Not the answer you're looking for? Browse other questions tagged or ask your own question.