Android examples for android.graphics:Bitmap Convert
Convert bitmap To Byte Array
import java.io.ByteArrayOutputStream; import java.io.IOException; import android.graphics.Bitmap; public class Main { public static byte[] bitmapToByteArray(Bitmap bitmap) throws IOException { ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); byte[] array = stream.toByteArray(); stream.close();//ww w .ja v a2 s. c om return array; } }