Search code examples
androidandroid-layoutandroid-intentbmp

load bmp image from byte array in android?


I am new to android,I developed one sample application which load the image from sd card and display as a bitmap image using image view controll. Now i want to modify my application like load the bmp from byte array i have the raw image ,width and height ,do any one have sample for this?


Solution

  • Use below Code for Convert Byte Array to Bitmap and display this bitmap into ImageView.

    Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
    ImageView image = (ImageView) findViewById(R.id.imageView1);
    image.setImageBitmap(bmp);
    

    and see below SO link for more information.

    Convert ByteArray to Bitmap