I am trying to set the foreground image on an image button. After some research, I came across this code sample:
<ImageButton android:text="Button" android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"/>
My query is how to actually implement android:src in code.
Try this:
where
newimageis the image name in drawable folder.EDITED
try this:
where bm is bitmap extracted from server.
EDITED AGAIN
I see you receive a Drawable; well, do this: