I have a camera app that allows the user to take pictures. On my main screen, I have a camera created on SurfaceView. When the user takes a photo, I call camera.autoFocus and in the AutoFocusCallback callback I call camera.takePicture. Then I save the photo and move on to another event to view the photo. I call camera.stopPreview () when exiting the camera page (onPause) and camera.startPreview () when returning (onResume).
The camera is initialized with FOCUS_MODE_CONTINUOUS_PICTURE. I donβt recycle the camera, returning to the camera page (since this is a slow operation that takes ~ 2 seconds), but just call startPreview if the camera was initialized before.
Here is my problem. Before the first photo, continuous autofocus works fine, because FOCUS_MODE_CONTINUOUS_PICTURE is initially set to the camera. However, after calling the camera.autoFocus function, the FOCUS_MODE_CONTINUOUS_PICTURE function stops working. Later, when I return to the same screen and call startPreview, continuous autofocus no longer works.
Is there a way to restart continuous autofocus without rebooting the camera? I would like to avoid restarting the camera, as this causes a few seconds of delay for the user.
source share