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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -