开发者

Android Camera API - Force Close Does Not Release Camera Resource [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. 开发者_Go百科

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 4 years ago.

Improve this question

So while developing a custom camera application I've realized on rare occasions and on various devices if the app has to force close, it does not always release the camera resource.

Is there a way to find/detect the process that is holding onto this resource and kill it? Or some other technique? It is rather difficult bug to reproduce (for me anyway), but ultimately the device has to be restarted.

Thanks!


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 !


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜