0
I have the following array:
<array name="Codes">
<item name="Vermelho">e74c3c</item>
<item name="Azul">3498db</item>
<item name="Rosa">FC14E5</item>
<item name="Roxo">8e44ad</item>
<item name="Amarelo">f1c40f</item>
<item name="Laranja">d35400</item>
<item name="Verde">2ecc71</item>
<item name="Cinza">95a5a6</item>
</array>
and I have a variable that holds the color code
Collections.shuffle(Arrays.asList(codes));
this.colorCode = "#" + codes[0];
how could I catch the name="" ?
Where this xml is saved?
– user28595
strings.xml, android default
– Osvaldo César
String[] some_array = getResources().getStringArray(R.array.your_string_array)
didn’t work out?– user28595
This would take the color code, which is what I already have, I would like to take the name of the array item, in case, Red
– Osvaldo César
Oh yes, you will need an xml parser, fortunately android too owns it. See the link as a reference until someone answers you.
– user28595
Okay, I’ll read it, thanks
– Osvaldo César