A
A
Alexey2016-06-10 01:33:46
Java
Alexey, 2016-06-10 01:33:46

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

2 answer(s)
V
viktormarkov, 2016-06-10
@alexey_sigida

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());

D
DuD, 2016-06-10
@DuD

And you can store images in base64 in the database. hehehe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question