Android - configure Spinner to use array

Viewed 81543

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" />

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?

3 Answers
Related