We provide complete mobile and web apps development solutions

Thursday, April 23, 2015

Bitmap to ByteArray Android

public static byte[] convertBitmapToByteArray(Bitmap bitmap) {
if (bitmap == null) {
return null;
} else {
byte[] b = null;
try {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.PNG, 0, byteArrayOutputStream);
b = byteArrayOutputStream.toByteArray();
} catch (Exception e) {
e.printStackTrace();
}
return b;
}

}

0 coment�rios:

Post a Comment

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts