On Android, I sometimes do the following with an image.
It never goes past the line of bitmapPicture.compress - it seems to just sit and hang.
The line above where I get the number of bytes returns 40,000.
I never see compression or any other result after "compression".
try {
final int COMPRESSION_QUALITY = 100;
String encodedImage;
ByteArrayOutputStream byteArrayBitmapStream = new ByteArrayOutputStream();
Log.e("Error","compress" + bitmapPicture.getByteCount());
bitmapPicture.compress(Bitmap.CompressFormat.PNG,
COMPRESSION_QUALITY, byteArrayBitmapStream);
Log.e("Error","compress done");
byte[] b = byteArrayBitmapStream.toByteArray();
Log.e("Error","bytear");
encodedImage = Base64.encodeToString(b, Base64.DEFAULT);
Log.e("Error","JSONDATA encodedImage Returned");
return encodedImage;
} catch (Exception e) {
ErrorLogger.AddError(e.getMessage(), 199);
Log.e("Error","JSONDATA Error"+e.getMessage());
return null;
}
source
share