Issue
I try to set icon into myButton, it works! (see the code below).
Button myButton = new Button(this);
myButton.setCompoundDrawablesWithIntrinsicBounds(R.drawable.abc_ic_menu_cut_mtrl_alpha, 0, 0, 0);
And now, I downloaded an image from a URL, bitmap.
My question is how to set myButton's icon by replace R.drawable.abc_ic_menu_cut_mtrl_alpha
to bitmap
.
Thank you for help.
Solution
it's work!!!
BitmapDrawable bd = new BitmapDrawable(getResources(), mybitmap);
myButton.setCompoundDrawablesWithIntrinsicBounds(bd,null,null,null);
Thank you, Rishad Appat, rekire and everybody. I can do it.
Answered By - nanniie
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.