问题
I m testing my app on moto x and even after setting flash mode on, flash is not working. App is working fine in other devices but not on Moto X. here is a code snippet
cameraInstance = getCameraInstance(cameraId);
// Setting the right parameters in the camera
Camera.Parameters params = cameraInstance.getParameters();
List<Size> list = params.getSupportedPictureSizes();
Size s = list.get(0);
for (Size size : list)
{
if (s.height < size.height)
s = size;
}
params.setPictureSize(s.width, s.height);
params.setPictureFormat(ImageFormat.JPEG);
params.setJpegQuality(85);
params.setFlashMode(Parameters.FLASH_MODE_ON);
cameraInstance.setParameters(params);
回答1:
Did you see : Camera FLASH_MODE_ON not working on Moto X ?
What is
Parameters param = mCamera.getParameters();
Log.i("camera", param.flatten().toString());
logging ? =)
回答2:
Well, it seems as in moto x, flash operation works only with some combination of Camera preview size and Camera picture size. I used different combination and it worked.
来源:https://stackoverflow.com/questions/24780686/camera-parameters-flash-mode-on-is-not-working-on-moto-x