From chasing up on all the other posts you have made on this subject, it appears like there is no sure fire way of getting the camera back after a crash without a restart of the device. A pain, to be sure. Best option is not to crash / catch everything that might fault. Which is a pretty rubbish answer, but that's what I'm endeavouring to do now.
I suggest you to see the code of google sample apps completely. the link is as follow. https://github.com/googlesamples/android-Camera2Basic As you can see in Camera2BasicFragment, mCameraOpenCloseLock Semaphore used to resolve release resources problems.
发布评论
评论(2)
通过追查您就此主题发表的所有其他帖子,似乎没有可靠的方法可以在崩溃后在不重新启动设备的情况下恢复相机。可以肯定的是,这是一种痛苦。最好的选择是不要崩溃/捕获所有可能出现故障的东西。这是一个相当垃圾的答案,但这就是我现在正在努力做的事情。
很多很多尝试捕捉!
From chasing up on all the other posts you have made on this subject, it appears like there is no sure fire way of getting the camera back after a crash without a restart of the device. A pain, to be sure. Best option is not to crash / catch everything that might fault. Which is a pretty rubbish answer, but that's what I'm endeavouring to do now.
Lots and lots of try catch !
我建议你完整地查看谷歌示例应用程序的代码。链接如下。
https://github.com/googlesamples/android-Camera2Basic
在Camera2BasicFragment中可以看到,mCameraOpenCloseLock Semaphore用来解决释放资源问题。
I suggest you to see the code of google sample apps completely. the link is as follow.
https://github.com/googlesamples/android-Camera2Basic
As you can see in Camera2BasicFragment, mCameraOpenCloseLock Semaphore used to resolve release resources problems.