I have positions like [1, 2, 3, 4]
I'm fetching array list from res/values/somearray.xml
My question is how can I get the string values from "res/xml/somearray.xml" array using the positions
So far my code:
String checkedids = String.valueOf(group.getCheckedIds()); //group.getCheckedIds() returns Set<Integer> positions basically
for (int i = 0; i < checkedids.length(); i++) {
if (checkedids.contains("1")) {
if (!TextUtils.isEmpty(valuez)) {
valuez = valuez + "Fashion";
} else {
valuez = "Fashion";
}
} else if (checkedids.contains("2")) {
if (!TextUtils.isEmpty(valuez)) {
valuez = valuez + "Lifestyle";
} else {
valuez = "Lifestyle";
}
}l
}
Result is not accurate with some repeated strings.
My arraylist.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="dummy_text">
<item>Fashion</item>
<item>Lifestyle</item>
<item>Beauty and Makeup</item>
<item>Parenting and Kids</item>
<item>Pets</item>
</string-array>
</resources>