我使用Camera2对象拍照。 它第一次像魅力一样,但我收到了一个" Unknow Error" (第二次通过OnErrorListener)。
我的问题是:在 onConfigured 之后,我是否需要手动关闭/释放CameraDevice? :
public void onConfigured(CameraCaptureSession cameraCaptureSession) {
try {
CaptureRequest.Builder requestBuilder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
requestBuilder.addTarget(imageReader.getSurface());
requestBuilder.set(CaptureRequest.CONTROL_AF_MODE, CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
cameraCaptureSession.capture(requestBuilder.build(), null, null);
} catch (CameraAccessException exception) {
exception.printStackTrace();
}
}