Camera camera = Camera.open(); Camera.Parameters parameters = camera.getParameters(); String flashMode = parameters.getFlashMode(); int exposureCompensation = parameters.getExposureCompensation();
Camera camera = Camera.open(); Camera.Parameters parameters = camera.getParameters(); parameters.setPreviewSize(640, 480); parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); camera.setParameters(parameters);In this example, we first open the camera using the Camera.open() method. We retrieve the camera's current parameters using getParameters() and then set the preview size and focus mode using the setPreviewSize() and setFocusMode() methods respectively. Finally, we set the updated parameters back to the camera using the setParameters() method. Package library: android.hardware.