In my app when i upload an image i want to reduce the data so i call this function. But this piece of code is giving me an outOfMemoryError.
LOGCAT: 09-17 15:32:01.712: E/AndroidRuntime(7771): at com.technow.pereo.FileHelper.reduceImageForUpload(FileHelper.java:64)
public static byte[] reduceImageForUpload(byte[] imageData) {
Bitmap bitmap = ImageResizer.resizeImageMaintainAspectRatio(imageData,
SHORT_SIDE_TARGET);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, outputStream);
bitmap.recycle();
byte[] reducedData = outputStream.toByteArray();
try {
outputStream.close();
} catch (IOException e) {
// Intentionally blank
}
return reducedData;
}
What is causing this error and how do I resolve it?!
0 comments:
Post a Comment