Relative Content

Tag Archive for javaandroidandroid-cameraandroid-camera2android-hardware

Manual Focus Distance in Android Camera2 API Not Applied Correctly Before Capturing Image

I’m working on an Android camera app using the android.hardware.camera2 API. I’m trying to set the manual focus distance using CaptureRequest.LENS_FOCUS_DISTANCE. While I can see from the logs that the focus distance is being applied, it only works correctly after I take a first picture and then take a second one (where it only gets applied for the second one) or change/move the slider.
Here’s the relevant code snippets:
StartCaameraPreview() method which is called in the CameraDevice.StateCallback onOpened callback: