I am trying to determine if flash is on or off so that with one button I can toggle it on and off. Here is my code :
Camera cam = getCameraInstance(); //A method that opens the cam
Camera.Parameters parameters = cam.getParameters();
System.out.println("Current flash mode " + parameters.getFlashMode());
System.out.println("flash mode off equals to : " + Camera.Parameters.FLASH_MODE_OFF);
System.out.println(parameters.getFlashMode() == Camera.Parameters.FLASH_MODE_OFF);
The output for the first two syso's is off
. Naturally I assumed that because they both return an off
string putting the ==
operator between them would return true
(thus allowing me to check if flash is on) but it returns false
. Any idea why?
I am targeting for api 16 and testing on a Marshmallow device