Ok guys, let’s say i have a String k = “image1”; and there is a picture in my drawable folder with name image1.png for example. How i can change a button image getting the name of the image from that string? Let’s say the button name is button1, then button1.setBackgroundResource(R.drawable.image1); could work, but i want something like button1.setBackgroundResource(R.drawable.k); and k get the value “image1”, so for example i can pick the image name from a database. Thanks
Share
This can be easily achieved by calling
Source