Access a image dynamically from res folder android -


i have image in res folder this

enter image description here

i want access 1 dynamically this

holder.viewcover.setimagedrawable(drawable.createfrompath("r.id." + coverimgurl.get(position))); 

coverimgurl list have 2 image name 1 book_cover & , blank_image array generated dynamically how can set image list

in 1 word how access image dynamically in drawable folder , need image name array list ?

resources res = getresources(); string mdrawablename = "image_name"; int resourceid = res.getidentifier(mdrawablename , "drawable", getpackagename()); drawable drawable = res.getdrawable(resourceid); icon.setimagedrawable(drawable ); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -