Answer the question
In order to leave comments, you need to log in
How to take filename from db and match it to file in drawable?
Good day everyone!
There is a DB in which (in a separate column) names of files (for example, pic1.jpg etc.) are stored.
In this case, the file itself is located in the drawable folder.
At the moment I have the following in the adapter:
ImageView ob_pic = (ImageView) my_view.findViewById(R.id.ob_pic);
ob_pic.setImageResource(coin.getObPic());
Obviously it doesn't work. It's not clear - how to write the mapping in the adapter correctly?
Answer the question
In order to leave comments, you need to log in
https://developer.android.com/reference/android/co... , java.lang.String, java.lang.String)
But just in case, I'll ask: Are you sure this is the right approach?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question