How to access values from strings.xml

Accessing string values in Kotlin works exactly the same as it does in Java, just with Kotlin syntax:

val string: String = getString(R.string.your_string_id)

(This assumes that your code is inside an Android Activity, or a similar class that inherits from Context. If not, you need to get a Context instance from somewhere, and change it to myContext.getString(...).)


if you're accessing it outside oncreate then

    Resources.getSystem().getString(R.string.btn_yes)