【发布时间】:2014-06-13 11:13:00
【问题描述】:
我正在使用位图。它抛出内存不足错误(5 次中有 2 次)。
怎么可能避免。
以下是我的代码:
bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, imageUri);
photo_new= rotateImage(bitmap, 90);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
photo_new.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] byteArray = stream.toByteArray();
Intent i = new Intent(getApplicationContext(),new_class.class);
i.putExtra("image", byteArray);
startActivity(i);
byteArray=null;
【问题讨论】:
-
它适用于不同的图像?有什么区别。什么时候会引发内存错误?
-
这些位图的大小是多少?
-
它抛出错误:
bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, imageUri);
标签: java android bitmap out-of-memory