title: Get the index of an array item based on the value
body: <p>I have a string array defined in arrays.xml that references two strings in strings.xml:</p>
  
  <pre><code>&lt;string-array name="my_options"&gt;
    &lt;item&gt;@string/my_string_one&lt;/item&gt;
    &lt;item&gt;@string/my_string_two&lt;/item&gt;
  &lt;/string-array&gt;
  
  &lt;string name="my_string_one"&gt;Value 1&lt;/string&gt;
  &lt;string name="my_string_two"&gt;Value 2&lt;/string&gt;
  </code></pre>
  
  <p>I need to get the position of an item in the array, based on the value of the string. I.e string "Value 2" has an index of 1. I can obviously just hard code the positional values (0, 1, etc.), but it will break if the order of the strings is changed. I want the code to be positionally independent. The following works:</p>
  
  <pre><code>int value = Arrays.asList((getResources().getStringArray(R.array.my_options))).indexOf(getString(R.string.my_string_one));
  </code></pre>
  
  <p>Is there a more compact, simpler way to do this?</p>