Open Chrison opened 8 years ago
I am not sure about visibility approach as it probably remains camera active. I have investigated slightly and come to conclusion that SurfaceView lifecycle is not currently handled properly in lib, looks as a bug. What I have done to fix the problem is added in order to re-initialize SurfaceView
private QRCodeReaderView camera; ...
@Override protected void onResume() { super.onResume(); camera.surfaceCreated(camera.getHolder()); camera.startCamera(); }
Hope it helps.
thanks, you saved my time!
The problem can be reproduced with the following steps,
1) Start the application and let the camera preview to appear. 2) Press the power button of the tablet to lock the device 3) Press the power button of the tablet to unlock the device 4) Target a QR code The logs doesn't show any change on SurfaceView
The QR is not recognized
5) Send the application on the background pressing the home button 6) Open the application again The logs show $ surfaceDestroyed $ surfaceChanged
The QR is now recognized.
I found a workaround which fixes this when i change the SurfaceView visibility in onPause/onResume.