1

I'm learning android apps programming and working on camera flash. I have the following code in my apps that I copied from another post. It works perfectly fine for Galaxy devices but not my LG Optimus X2. I did set the Manifest permission, I don't have any clue about the issue, any help is highly appreciated.

Camera mycam = Camera.open();
Parameters p = mycam.getParameters();// = mycam.getParameters();
p.setFlashMode(Parameters.FLASH_MODE_TORCH); 
mycam.setParameters(p); //time passes 
try {
    Thread.sleep(500);
} catch (InterruptedException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
p.setFlashMode(Parameters.FLASH_MODE_OFF);
mycam.release();

Btw, any code that can work for all android devices with a flash? or it must be device specific? Where can I get those information, I don't find much related info.

shaunhusain
  • 19,630
  • 4
  • 38
  • 51
babyromeo
  • 465
  • 5
  • 12

0 Answers0