i am developing one spinner this spinner i am string array
spinner = (Spinner)this.findViewById(R.id.mlg);
final CharSequence[] itemArray =getResources().getTe
I am not sure either Spinner allow that attribute value in XML String or not but your problem can be solved like this.
Create two arrays in your array.xml
file like:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="items">
<item>Nokia 1200</item>
<item>Nokia 1600</item>
<item>Nokia 5130</item>
</string-array>
<string-array name="values">
<item>1000</item>
<item>2000</item>
<item>5000</item>
</string-array>
</resources>
Now load first array in your adapter and store the second one in other Array to hold values of items as:
String items [] = getResources().getStringArray(R.array.items);
String values [] = getResources().getStringArray(R.array.values);
And you can simply get the respective item name and value in your onItemSelected()
method like this:
String item = parent.getItemAtPosition(pos).toString();
String value = values [pos];