I have a spinner in which I would like to select a state in the U.S. like 'Texas', and then capture that selection. I want the display on the spinner to be "Texas", "California", "Utah", etc, but when the user selects it, and I capture the value, I want the value to be '57' instead of "Texas". I know I can just do:
String selection = my_spinner.getSelectedItem().toString();
int selectionVal;
if(selection = "Texas"){
selectionVal = 57;
}
But I would have to do that for a lot of states. Is there a way to do it like I explained above? If not, what would be the most efficient way of doing this? Thank you.