【发布时间】:2015-09-25 21:15:17
【问题描述】:
我正在做如下缩放的位图
Bitmap resizedBitmap = Bitmap.createScaledBitmap(BitmapFactory.decodeFile(picturePath), 960, 730, false);
在进行此处理时,我有时会上传图像,但遇到类型错误
java.lang.OutOfMemoryError: Failed to allocate a 31961100 byte allocation with 15257484 free bytes and 14MB until OOM
请帮我解决一下?
【问题讨论】:
-
使用
BitmapFactory.Options对象作为decodeFile()的第二个参数。将BitmapFactory.Options上的inSampleSize设置为使您接近所需缩放大小的值。 -
您的操作将需要比可用内存更多的内存。您希望我们提供什么样的解决方案/帮助?
-
@CommonsWare 请举例说明如何使用 BitmapFactory.Options?
-
@anderas 请给我解决方案如何增加内存?
标签: android