I am working on an Android application and I have multiple string arrays defined in my strings.xml
file. In my app, I have an input box where the user can type a specific keyword, and based on that keyword, I want to retrieve the corresponding string array dynamically.
For instance, let's say I have the following arrays defined in my strings.xml
file:
<string-array name="fruit">
<item>Apple</item>
<item>Orange</item>
<item>Banana</item>
</string-array>
<string-array name="colors">
<item>Red</item>
<item>Green</item>
<item>Blue</item>
</string-array>
Now, if the user types "fruit" in the input box, I want to fetch the array named fruit, and if the user types "colors", I want to retrieve the array named colors. How can I achieve this dynamically in my Android application?
Any help would be appreciated, thanks in advance.