I am able to get resource Id by string name by using the following
fun resIdByName(): Int {
return resources.getIdentifier("apple", "drawable", packageName)
}
but the issue is I have dark/light mood support in my app and this method is returning light image for dark mood and dark image for light mood.
I have search a lot on the internet but only found a way to get res from the name not how to get base on theme, so do not consider this a duplicate question.
from How to get drawable resource id from string name base on current app theme in android (dark/light theme)
No comments:
Post a Comment