I am trying to set the foreground image on an image button. After some research, I came across this code sample:
Try this:
ImageButton btn = (ImageButton)findViewById(R.id.button1);
btn.setImageResource(R.drawable.newimage);
where newimage
is the image name in drawable folder.
EDITED
try this:
ImageButton btn = (ImageButton)findViewById(R.id.button1);
btn.setImageBitmap(bm);
where bm is bitmap extracted from server.
EDITED AGAIN
I see you receive a Drawable; well, do this:
normalImage = Drawable.createFromStream(code);
Bitmap bm = ((BitmapDrawable)normalImage).getBitmap();
ImageButton btn = (ImageButton)findViewById(R.id.button1);
btn.setImageBitmap(bm);