ZXing CaptureActivity黑屏问题

   ZXing的CaptureActivity在其他activity切换回来时会出现黑屏现象,跟踪发现surfaceDestroyed并不一定能调用到。

   在ZXing项目找到zxing不支持tabhost的答复。

Project Member #1 srowen
The app doesn't use a TabHost. If you are writing your own app, indeed, you may need to write different code! this part is not a library that is supposed to work in other contexts.

   虽然项目采用tabactivity搭建框架,但CaptureActivity是单独的activity。

   针对surfaceDestroyed在activity切换时不会总是调用的问题,https://github.com/commonsguy/cw-advandroid/tree/master/Camera/Preview/ 的解决方法值的参考。

也即是把打开摄像头的动作延迟到surfaceChanged时调用。

相关推荐