Answer the question
In order to leave comments, you need to log in
How to match an image to a string in a database?
I have a local db ( SQLite ) where the cities are (i.e. id and title ). Each city has a coat of arms (i.e. I have pictures in the project). How can I give each city its own coat of arms?
android studio, java.
Answer the question
In order to leave comments, you need to log in
You can store the name of the image in the database as a string. Pulling out, get resource id by method
String imageName = getImageNameFromDB // "gerb"
int id = getResources().getIdentifier(imageName, "drawable", getPackageName());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question