Java tutorial
//package com.java2s; import android.graphics.Bitmap; import java.nio.ByteBuffer; public class Main { public static Bitmap byteArrayToBitmap(int width, int height, byte[] byteArray) { // use Bitmap.Config.ARGB_8888 instead of type is OK Bitmap stitchBmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); stitchBmp.copyPixelsFromBuffer(ByteBuffer.wrap(byteArray)); return stitchBmp; } }