如何在Java Me中进行闪光灯应用



试图制作闪光灯应用程序,我没有使它起作用。这是我的代码:

public void setFlash(Controllable player) {
    FlashControl flashControl =
            (FlashControl) getControl(player, "javax.microedition.amms.control.camera.FlashControl");
    if (flashControl != null) {
        int[] supportedFlash = flashControl.getSupportedModes();
        if (supportedFlash != null && supportedFlash.length > 0) {
            for (int i = 0; i < supportedFlash.length; i++) {
                if (supportedFlash[i] == DESIRED_FLASH) {
                    try {
                        flashControl.setMode(DESIRED_FLASH);
                    } catch (IllegalArgumentException iae) {
                        // continue
                    }
                    break;
                }
            }
        }
    }
}

根据JSR 234文档FlashControl有六个公共常数:

  • 自动:相机将根据照明条件自动弹跳
  • auto_with_redeyereducus:相机将根据照明条件自动闪光,如果闪烁,它将使用红眼睛减少
  • 填充:减少闪光灯
  • 力:相机闪光灯在
  • force_with_redeyereducus:相机闪光灯正在使用,红眼还原正在使用
  • 关闭:相机闪光灯关闭

您应该使用force或force_with_redeyereduce

最新更新