I am writing an application that sets the flash mode to a torch. I tested the application on my Droid X and the LED does not light up. I tried this on Droid Incredible and it worked great. I canβt understand what the problem is. Here is part of my code to enable torch mode.
Camera mCamera = Camera.open(); Camera.Parameters params = mCamera.getParameters(); if(params.getFlashMode() != null){ params.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); } mCamera.setParameters(params);
I added mCamera.startPreview (); because I read that it should matter, but it is not. I also made a list of available flash modes and displayed them on the screen to make sure my Droid X had a torch mode and it was on the list. I even created a new application from code that I found on the Internet that turns on and off the LED flash with a button. Again, it worked great on Droid Incredible, but not on Droid X. Is there something Iβm missing to get it to work on Droid X, or could it be something with Gingerbread? Droid X runs Gingerbread, while Droid Incredible launches FroYo.
source share