Memory efficient image resize in Android

女生的网名这么多〃 提交于 2019-11-28 16:54:49
EboMike

When you decode the bitmap with the BitmapFactory, pass in a BitmapFactory.Options object and specify inSampleSize. This is the best way to save memory when decoding an image.

Here's a sample code Strange out of memory issue while loading an image to a Bitmap object

Are you taking the picture with the camera within your application? If so, you should set the picture size to a smaller one in the first place when they're being captured via android.hardware.Camera.Parameters.setPictureSize

toidiu

Here is a similar question that I answered and show how to go about dynamically loading the proper image size.

out of memory exception + analyzing hprof file dump

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!