I tried to do it through "string" but it doesn't work. How to do it?
var TestString : String = "test1.png"
var TestId : Int = R.drawable.TestString
I tried to do it through "string" but it doesn't work. How to do it?
var TestString : String = "test1.png"
var TestId : Int = R.drawable.TestString
You can do it this way:
val resId = applicationContext.resources.getIdentifier("test1", "drawable", applicationContext.packageName)
yourImageView.setImageResource(resId)