android:decodeFile方法中的java.io.FileNotFoundException(打开的文件太多)
我正在做图像的实时观看流。
我意识到,在运行我的程序大约几分钟后,应用程序将自行关闭,并出现以下窗口错误:java.io.FileNotFoundException(打开的文件太多)
跟踪logcat输出,错误发生在这一行附近:
Bitmap bitmap = BitmapFactory.decodeFile(file, bmpFactoryOptions);
我看到有一些类似的问题,但没有提供太多解决方案。
由于错误是我由于这个decodeFile方法而打开了太多文件,所以我有什么方法可以关闭这个文件引用吗?
谢谢大家!
i am doing a liveview streaming of image.
i realised that after running my program for around few minutes, the application will close by itself with the following window error: java.io.FileNotFoundException (Too many open files)
tracing the logcat output, the error happen at around this line:
Bitmap bitmap = BitmapFactory.decodeFile(file, bmpFactoryOptions);
i see that there a few similar question but it do not provide much solution.
since the eorror is i am opening too much files because of this decodeFile method, is there any way for me to close this file reference?
thanks all!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的是自己打开文件,将输入流传递给 BitmapFactory 的decodeStream 方法,然后自己关闭文件。
What you could do is open the file yourself, pass the inputstream to the decodeStream method of BitmapFactory, then close the file yourself.