I am creating a simple quiz app, that could use the resources of the array.xml (no external parser, no adapters)
<string-array name="Question1">
<item name="Question">This is Question1</item>
<item name="Answer">option1</item>
<item name="option1">option2</item>
<item name="option2">option3</item>
<item name="option3">option4</item>
</string-array>
I got all the elements with this code
String[] quesArray = getResources().getStringArray(R.array.Question1);
Now I want to get the string “Answer” , so that it can be further used and manipulated How Is it possible? I tried it with
int resId = context.getResources().getIdentifier("Answer", "string", getPackageName());
but it gives error
android.content.res.Resources$NotFoundException: String resource ID #0x0