android - How to retrieve an image and display -


i new android -

i storing images in drawable , there name in sqlite database. subset of these images used @ time. images used decided query on data base.

for example database query produces - these strings

"pic1", "pic2" ... etc

to used them 1 needs value of r.drawable.pic1.

is there way retrieve image drawable bu name (string containg name of file).

try this

int id = context.getresources().getidentifier(drawableresourcename, "drawable", context.getpackagename()); 

it should give drawable id, , can use r.drawable.drawableresourcename


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -