I have a spinner. I want to get the value of the item selected and search the index of that value in another array. This is what I have tried so far. s1 is the spinner. weapons is the array in which I want to search the value of the selected item in spinner s1
String[] weaponone = getResources().getStringArray(R.array.weapons);
for (String s : weaponone) {
int i = s.indexOf(s1.getSelectedItem().toString());
switch (i) {
case (0):