In my Activity I need to get a group of values from string.xml
and add them to my mutableList.
It's inconvenient to retrieve them manually like this:
specArray.add(R.string.string1)
specArray.add(R.string.string2)
specArray.add(R.string.string3)
specArray.add(R.string.string4)
//...
I tried to wrap it in a loop, and I ended up with something like this:
var count = 0
var specArray = mutableListOf<String>()
val stringCustom = "specC"
var buffer = getString(R.string.stringCustom)
while(count <= 36) {
specArray.add(buffer)
buffer = getString(string)
val specArray = mutableListOf<String>()
count++
}
but obviously it doesn't work, because we cannot specify a path to the resource with stringCustom in it.