Even as hundreds of other have made them, i am trying my hand at a
flashlight app. I have the basic GUI and widget working and toggling,
and i just attempted to implement the actual flash from the phone.
I have found many places that this is most easily done with this
snippet of code:

Camera mCamera = Camera.open();
Parameters params = mCamera.getParameters();
params.setFlashMode( Parameters.FLASH_MODE_TORCH );
mCamera.setParameters( params );

I have tried this code, and every time i run the app it crashes,
giving me an output in LogCat of the following:

02-07 00:04:49.130: E/AndroidRuntime(4861): Caused by:
java.lang.RuntimeException: Fail to connect to camera service

Every other app that uses the camera or flash works fine, and i have
no idea what is causing it to fail.

In my android manifest i have:

<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-parmission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.flash" />

Any and all help is greatly appreciated as I am completely stuck after
sitting at this for the last several hours...
Thanks
~Matt

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to