While developing a camera app I\'ve encountered an exception that only happened when I switch to other app (onPause() for my app).
01-15 17:22:1
I faced same issue, i fixed it by - Adding mCamera = null; in surfaceDestroyed(SurfaceHolder holder) method of Preview class.
public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return, so stop the preview.
if (mCamera != null) {
mCamera.stopPreview();
mCamera.release();
mCamera = null;
}
}
and - Adding
camera = Camera.open();
camera.startPreview();
params = camera.getParameters();
preview.setCamera(camera);
in OnResume() method of my CameraActivity.