Bitmap bmp = intent.getExtras().get("data");
int size = bmp.getRowBytes() * bmp.getHeight();
ByteBuffer b = ByteBuffer.allocate(size);
bmp.copyPixelsToBuffer(b);
byte[] bytes = new byte[size];
try {
b.get(bytes, 0, bytes.length);
} } catch (BufferUnderflowException e) {
//Exception handling
}
// Byte[] Processing
What's wrong with Ekid? Why isn't it moving?
java android serialization bitmap bytebuffer
Bitmap bmp = intent.getExtras().get("data");
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
Do it like this.
© 2024 OneMinuteCode. All rights reserved.