开发者

Droid X Flashlight doesn't turn on the same way as other phones?

I've been developing and app to turn on the LED light next the camera on Android. I have my code working for the Incredible and the Charge (because they are the only two other devices I have to test on) but I can't seem to get the Droid X LED to turn on. Is there some other way to turn on the camera's flashlight programmatically? I am also pretty sure all my permissions are correct considering it does work on other phones.

Here is the basic code being used to turn it on.

cam = Camera.open();
params = cam.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_TORCH);
cam.setParameters(params);
cam.startPreview();
开发者_如何学Python


You can't just set any flash mode you want because a camera driver may not support it. You need to get available flash modes using Parameters.getSupportedFlashModes(), check whether the mode you want to set is supported or not and set it if it's supported. So I assume it's not supported on Droid X.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜