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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -