We provide complete mobile and web apps development solutions

Showing posts with label bytearray conversion. Show all posts
Showing posts with label bytearray conversion. Show all posts

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;
}

}

Online Training

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

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts