Open remq opened 8 years ago
I've fixed it for myself by adding a confirm-picture screen. This way the camera has enough time to close itself and it's a good practice anyway. However, this issue might be worth looking into.
I solved the problem by calling camera.stop()
instead of navigating away and overriding onCameraClosed
in CameraView.Callback
. I wait until the camera is closed and then perform the navigation.
i have the same bug
FYI, I have the same bug on Samsung Galaxy S7, API 23
@PavelSynek can you give a sample of how your sollution works?
Sure! I don't think I can find the exact code, but this pseudocode should help too.
private boolean navigateAfterCameraStop = false;
cameraView.addCallback(new CameraView.Callback() {
@Override
public void onPictureTaken(CameraView cameraView, byte[] data) {
//
}
@Override
public void onCameraClosed() {
if (navigateAfterCameraStop) {
navigateAfterCameraStop = false;
navigateForReal();
}
}
});
public void onNavigate() {
// Do not navigate, but set the flag, stop camera, wait for it to close and then navigate
navigateAfterCameraStop = true;
cameraView.stop();
}
Just added
catch (NullPointerException n) {
n.printStackTrace();
}
to method unlockFocus() in Camera2.java class Dirty trick, but works.
Just added
catch (NullPointerException n) { n.printStackTrace(); }
to method unlockFocus() in Camera2.java class Dirty trick, but works.
Really work for me!!!!
Just added
catch (NullPointerException n) { n.printStackTrace(); }
to method unlockFocus() in Camera2.java class Dirty trick, but works.
Just added
catch (NullPointerException n) { n.printStackTrace(); }
to method unlockFocus() in Camera2.java class Dirty trick, but works.
Really work for me!!!!
+1
Same error on Xiaomi: Redmi Note 7.
@andzejsw got any solution??
I only got this error on my Huawei Ascend P7 device and not on a Samsung Galaxy S5. When taking a picture, it crashes.
When deleting the following line it works, however I need to close the camera fragment.
getActivity().getSupportFragmentManager().popBackStack();
This is the error:
My guess is that I need to listen to another callback before killing the camera, but I couldn't find one.