set bitmap to background of ImageView with imageView.setImageBitmap method

Please Use the following line to set image background.

imageview.setBackground(getResources().getDrawable(R.drawable.uporder));

Here uporder is an image resource present in your drawablefolder.


try this..

Create drawable using bitmap & use setBackgroundDrawable(Drawable d) method for imageview.

Drawable d = new BitmapDrawable(getResources(),bitmap);

imageview.setBackgroundDrawable(d);

I have tested and it's done

I think you are getting Bitmap

So you have to convert Bitmap to BitmapDrawable

like

  BitmapDrawable ob = new BitmapDrawable(getResources(), bitmap)

then just set bitmap with below function

  imageView.setBackground(ob);

by this way you can do it..


Try following code to set your own bitmap as background.

Bitmap bitmap = ...;
ImageView imageView = ...;
Drawable drawable = new BitmapDrawable(getResources(), bitmap);
imageView.setBackground(drawable);