android - How can I set a String variable on R.drawable with glide? -


this question has answer here:

i'm using glide library load images , made method goes this:

void alterarinformacoes(imageview slotimagem, string image) {         glide.with(this)                 .load(r.drawable.image)                 .into(slotimagem);     } 

but doesn't work, i'd know if there's way use string name of drawable can use function dynamically set images.

you can int value of drawable resource name code:

int drawableresourceid = this.getresources().getidentifier("nameofdrawable", "drawable", this.getpackagename()); 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -