In my values.xml file, I have an array, like this;
<string-array name="animals-array">
<item>Cow</item>
<item>Pig</item>
<item>Bird</item>
<item>Sheep</item>
</string-array>
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
Help in getting String Array from arrays.xml file
and this
Retrieving a random item from ArrayList
But how do I retrieve a random item from my list that is defined in the values.xml file?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…