just started dabbling in Android and have been told that Strings shouldnt be hard coded into Java but put into the string resource folder.
I have existing code where in a hashmap the key and value are both strings.How would i go about putting the strings into xml and taking them out of the java part completely?
Should I just create a string in the string resource folder like so
<string name="hello">Hello.world</string>
with hello being the key and world being the value and then just parse the string using the . as a delimiter?
Hopefuly I’ve explained myself correctly
There are many other resource types that you can define in the res folder. You can see the available ones here and here. For your purpose, One approach could be defining an array in res/values/arrays.xml:
and in the code: