Android camera: can't change flash mode from torch to other mode

In android L, I am trying to set the camera flash mode to TORCH

and it works fine, but I cannot change it back to flash AUTO

mode or flash mode ON

. I can go back to flash mode OFF

. I tried popular camera apps like camera360, even they failed. Is this a bug in android L or is it required to use new CAMERA2

api?

+3


source to share


1 answer


This looks like a bug in the Android Lollipop version. This is how I solved it

 Camera.Parameters parameters =  mCamera.getParameters();
 parameters.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
 mCamera.setParameters(parameters);
 parameters.setFlashMode(yourFlashMode);
 mCamera.setParameters(parameters);

      



Remember to check if the flash mode is supported by calling mCamera.getParameters().getSupportedFlashModes()

+1


source







All Articles