android - How can I set a String variable on R.drawable with glide? -
this question has answer here:
- how resource id known resource name? 7 answers
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
Post a Comment