Android how to know if flashlight is on

﹥>﹥吖頭↗ 提交于 2020-01-04 03:14:29

问题


I am using CameraManager and CameraCharacteristics

I would like to know how to check if the flashlight is turned on


回答1:


Try this bit of code

public boolean FlashStatus() {


    Camera.Parameters parameters = camera.getParameters();

    if (parameters.getFlashMode() == "FLASH_MODE_TORCH") {
        return true;
    }

    if (parameters.getFlashMode() == "FLASH_MODE_OFF") {
        return false;
    }

}


来源:https://stackoverflow.com/questions/38827344/android-how-to-know-if-flashlight-is-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!