Change value of R.string programmatically

One thing what you have to understand here is that, when you provide a data as a Resource, it can’t be modified during run time. For example, the drawables what you have in your drawable folder can’t be modified at run time. To be precise, the “res” folder can’t be modified programatically.

This applies to Strings.xml also, i.e “Values” folder. If at all you want a String which has to be modified at runtime, create a separate class and have your strings placed in this Class and access during run time. This is the best solution what I have found.

Leave a Comment