我正在尝试将相机自动对焦设置为 ON ...但是每当我设置setFocusMode
应用程序崩溃时..
java.lang.RuntimeException: setParameters failed
我的代码是:
Camera.Parameters parameters = camera.getParameters();
parameters.setFlashMode(Parameters.FLASH_MODE_TORCH);
Camera.Size size = getBestPreviewSize(width, height, parameters);
Camera.Size pictureSize = getSmallestPictureSize(parameters);
if (size != null && pictureSize != null) {
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
parameters.setPreviewSize(size.width, size.height);
parameters.setPictureSize(pictureSize.width, pictureSize.height);
parameters.setPictureFormat(ImageFormat.JPEG);
camera.setParameters(parameters);
cameraConfigured = true;
}
为什么会出现这个错误?