Android examples for Graphics:Bitmap Byte Array
decode Byte Array to Bitmap
//package com.java2s; import android.graphics.Bitmap; public class Main { public static Bitmap decodeByteArray(final byte[] data, final Bitmap.Config config) { return decodeByteArray(data, 0, data.length, config); }/*from w w w.j a v a 2s. c om*/ public static Bitmap decodeByteArray(final byte[] data, final int offset, final int length, final Bitmap.Config config) { Bitmap bitmap = android.graphics.BitmapFactory.decodeByteArray( data, offset, length); if (bitmap.getConfig().compareTo(config) == 0) { return bitmap; } final int[] pixels = new int[bitmap.getWidth() * bitmap.getHeight()]; bitmap.getPixels(pixels, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight()); bitmap.recycle(); return Bitmap.createBitmap(pixels, bitmap.getWidth(), bitmap.getHeight(), config); } }