Saturday, February 25, 2012

[android-developers] Camera torch mode in ICS (Galaxy Nexus)

Hi,

if someone know why cameras flash light won't turn on? I made some
standard code to turn on flashlight but nothing seems to happened. I
even checked status of flash (getFlashMode) with result "torch". I
don't if I miss something. There is some of my code:

mCam = Camera.open(BACK_CAMERA);
mParams = mCam.getParameters();

// turning on:
mParams.setFlashMode(Parameters.FLASH_MODE_TORCH);
mCam.setParameters(mParams);
mCam.startPreview();

// turning off:
mParams.setFlashMode(Parameters.FLASH_MODE_OFF);
mCam.setParameters(mParams);
mCam.stopPreview();

// state checking:
vStat.setText(mParams.getFlashMode());

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment