I have the strings.xml file looking like this:
<resources>
<string name="key1">value1</string>
<string name="key2">value2</string>
</resources>
In the code I have got the string "key1"
.
Now I want to access the value "value1"
in my strings.xml file.
How can I get the value having the key only as string?
Is there a way to to this?
The only way I see is to instantiate some map mapping the key as string to the resouce IDs.
val map = mapOf("key1" to R.string.key1, "key2" to R.string.key2)
val value1 = map["key1"]
But maybe there is a simpler solution...
Thank you for your help!