Camera.Parameters.FLASH_MODE_ON is not working on Moto X

萝らか妹 提交于 2019-12-12 15:18:45

问题


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

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