Closed joerandazzo closed 7 years ago
@arpitgandhi9 Will this be resolved?
Values are passed via Intents. Even if catch the exceptions to stop the crash, we wont be able to use the library. Is there a specific reason for you to use "Do not keep activities"?
Also do you have any other suggestions than using activities. Was thinking of converting it all into fragments, but it is a long process that can take a lot of time.. Will definitely do it but for now can we go ahead with this?
How to Enable 'Do not keep activities' in developer mode? As i am facing the same error. Hope disabling them might give me more information related to issue.
Note: the same issue occur because of:
@Override
public void openCamera(final Integer cameraId,
final CameraOpenListener<Integer, SurfaceHolder.Callback> cameraOpenListener) {
this.currentCameraId = cameraId;
backgroundHandler.post(new Runnable() {
@Override
public void run() {
try {
camera = Camera.open(cameraId);
prepareCameraOutputs();
if (cameraOpenListener != null) {
uiHandler.post(new Runnable() {
@Override
public void run() {
cameraOpenListener.onCameraOpened(cameraId, previewSize, currentInstance);
}
});
}
} catch (Exception error) {
Log.d(TAG, "Can't open camera: " + error.getMessage());
if (cameraOpenListener != null) {
uiHandler.post(new Runnable() {
@Override
public void run() {
cameraOpenListener.onCameraOpenError();
}
});
}
}
}
});
}
@Override
public void closeCamera(final CameraCloseListener<Integer> cameraCloseListener) {
backgroundHandler.post(new Runnable() {
@Override
public void run() {
if (camera != null) {
camera.release();
camera = null;
if (cameraCloseListener != null) {
uiHandler.post(new Runnable() {
@Override
public void run() {
cameraCloseListener.onCameraClosed(currentCameraId);
}
});
}
}
}
});
}
what if camera fragment is resumed and paused instantaneously (race around condition). Then, same error will be generated as camera is released at that time
D/SandriosCameraFragment: onResume:
D/Camera1Controller: onResume:
D/Camera1Manager: openCamera:
D/SandriosCameraFragment: onPause:
D/Camera1Controller: onPause:
D/Camera1Manager: closeCamera:
Instructions to recreate:
Process: com.coolfiresolutions.ronin.sa.base, PID: 17834 java.lang.NullPointerException: Attempt to invoke virtual method 'android.hardware.Camera$Parameters android.hardware.Camera.getParameters()' on a null object reference at com.sandrios.sandriosCamera.internal.manager.impl.Camera1Manager.getPhotoSizeForQuality(Camera1Manager.java:203)
I found that onPause is called in SandriosCameraActivity which calls onPause on cameraController which nulls out camera before Camera.getParameters is called