I create a Spinner
element inside of my LinearLayout
. I want to make values different from visible. I don't want to do that programmatically. I want to use arrays that below.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="select">
<item>a</item>
<item>b</item>
<item>c</item>
</string-array>
<integer-array name="selectValues">
<item>1</item>
<item>2</item>
<item>3</item>
</integer-array>
</resources>
Simply. If a
selected item, I want to get 1
as integer. What's the way?
<Spinner
android:id="@+id/sSelect"
android:layout_width="179dp"
android:layout_height="60dp"
android:layout_gravity="center"
android:entries="@array/select"
android:entryValues="@array/selectValues" />
When I use above with below.
public void onItemSelected(AdapterView<?> item, View arg1, int sort,
long arg3) {
// TODO Auto-generated method stub
String selectedItem = item.getItemAtPosition(sort).toString();
}
I just can get data as string and not values. I can get values that visible.