I have a spinner in my app where the user chooses whether he wants to search by "Contains" "Starts with" "Ends with" or "Equals", The option user selects is stored into a json with other information and sent to server to retrieve results. Now I'm using:
String searchtypeval=searchtype.getSelectedItem().toString(); and adding searchtypeval into my json. The String-array in the spinner is
<string-array name="search_options"> <item>Starts With</item> <item>Equals</item> <item>Ends With</item> <item>Contains</item> </string-array> But now I'm adding language support so in values-fr/strings.xml the string array for that spinner is
<string-array name="search_options"> <item>Commence par </item> <item>Égal </item> <item>Se termine par </item> <item>Contient </item> </string-array> Now if the user selects equals in french , Egal is stored into the JSON which of course the server doesn't accept. Is there any way I can make a connection between the french and the english strings.xml? All I can think of now is to use searchtype.getSelectedItemPosition() and hard code the value into String searchtypeval since I know which option is which position, but this seems very cumbersome, is there any method to solve this issue that is more elegant?