Android的onPictureTaken回调抛出内存异常的Bitmap.de codeByteArray [英] Android onPictureTaken callback throws out of memory exception in Bitmap.decodeByteArray

查看:224
本文介绍了Android的onPictureTaken回调抛出内存异常的Bitmap.de codeByteArray的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我自己的三星Galaxy S3,它能够捕捉尺寸〜3000×2000的pitures和,我目前正在开发一个需要拍摄照片的应用程序。我用我的手机作为调试器和我设置该设备提供了画面被捕捉最佳的尺寸。

I own a Samsung Galaxy S3, which is capable of capturing pitures of size ~3000 x 2000. And, I am currently developing an application that requires capturing pictures. I use my phone as debugger and I set the best possible size that the device offers for the picture to be captured.

不过,如果我使用此设置,则回调 onPictureTaken 给出了内存不足的错误在它的 Bitmap.de $的第一行C $ cByteArray 的方法,我尝试去code捕获的字节成位图。如果我使用 Bitmap.Options.inSampleSize = 2 ,不会发生内存不足的错误。

However, if I use this setting, the callback onPictureTaken gives out of memory error at the very first line of it in Bitmap.decodeByteArray method where I try to decode the captured bytes into a bitmap. If I use Bitmap.Options.inSampleSize = 2, there occurs no out of memory error.

我想要的应用程序能够捕捉到最好的设备提供的,而且,该设备确实该在自己的相机应用程序,但我在我的不能。我听不懂。我怎样才能解决这个问题?

I want the application to be able to capture the best that the device offers, and, the device does this in its very own camera application but I can't in mine. I don't understand. How can I overcome this problem?

推荐答案

HTTP:// WWW。 youtube.com/watch?v=_CruQY55HOk Android的自定义视图的位图的内存泄漏。也看看这个视频。有关MAT分析这应有助于会谈。同时回收位图时不使用

http://www.youtube.com/watch?v=_CruQY55HOk. Android custom view Bitmap memory leak. Also have a look at this video. Talks about MAT analyzer which should help. Also recycle bitmaps when not in use

这篇关于Android的onPictureTaken回调抛出内存异常的Bitmap.de codeByteArray的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆