本文介绍了Camera.Parameters.FLASH_MODE_ON不工作在极限摩托的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我米的极限摩托测试我的应用程序,甚至在设置闪光模式后,闪光灯不工作。应用程序在其它设备工作正常,但不是摩托X.
这里是一个code段

  cameraInstance = getCameraInstance(cameraId);    //在相机设置正确的参数
    Camera.Parameters PARAMS = cameraInstance.getParameters();
    清单<尺寸和GT;清单= params.getSupportedPictureSizes();    大小S = list.get(0);
    对于(尺寸大小:名单)
    {
        如果(s.height< size.height)
            S =大小;
    }    params.setPictureSize(s.width,s.height);
    params.setPictureFormat(ImageFormat.JPEG);
    params.setJpegQuality(85);
    params.setFlashMode(Parameters.FLASH_MODE_ON);    cameraInstance.setParameters(PARAMS);


解决方案

好了,它似乎在极限摩托,闪光操作仅适用于摄像头preVIEW尺寸和摄像头像素大小的组合。我用不同的组合,它的工作。

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);
解决方案

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.

这篇关于Camera.Parameters.FLASH_MODE_ON不工作在极限摩托的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 10:43