java - android set ImageView src by parameter -
i need set image resource send parameter (string src
)
i have code
public void getsource(view view , string src){ imageview image = (imageview)findviewbyid(r.id.img); image.setimageuri(src); }
how solve problem ؟
// method call set image private void setimage(int src) { imageview iv = findviewbyid(r.id.your_image_view); iv.setimageresource(src); }
//pass resource , use :-
setimage(r.drawable.plus_active);
Comments
Post a Comment