title: How to get a random value from a string array in android?
body: <p>In my values.xml file, I have an array, like this;</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;string-array name="animals-array"&gt;
      &lt;item&gt;Cow&lt;/item&gt;
      &lt;item&gt;Pig&lt;/item&gt;
      &lt;item&gt;Bird&lt;/item&gt;
      &lt;item&gt;Sheep&lt;/item&gt;
  &lt;/string-array&gt;
  </code></pre>
  
  <p>In my app, I want to get one of these values at random, but I am unsure how to do this. I have looked at </p>
  
  <p><a href="https://stackoverflow.com/questions/2453989/help-in-getting-string-array-from-arrays-xml-file">Help in getting String Array from arrays.xml file</a></p>
  
  <p>and this</p>
  
  <p><a href="https://stackoverflow.com/questions/5034370/retreiving-an-item-from-arraylist-at-random">Retrieving a random item from ArrayList</a></p>
  
  <p>But how do I retrieve a random item from my list that is defined in the values.xml file?</p>