Set flash mode in android -


i got example set flash mode, cant make work. using in camera swap:

        final imagebutton button1 = (imagebutton) findviewbyid(r.id.bt_camera);     button1.setonclicklistener(new view.onclicklistener() {         public void onclick(view v) {             camera.release();             idcam.id = idcamera(idcam.id);             camera = camera.open(idcam.id);             camera.parameters parametro = camera.getparameters();             parametro.setflashmode(parameters.flash_mode_on);             camera.setparameters(parametro);             camera.startpreview();                 try {             camera.setpreviewdisplay(camholder.id);             } catch (ioexception e) {                 e.printstacktrace();             }         }     }); 

without flash parameters, swap works fine.

included in manifest permission:

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

but log returns:

05-21 09:25:02.985: d/ipcthreadstate(24048): [dn #5] br_clear_death_notification_done cookie 0x64fca0 05-21 09:25:03.260: d/androidruntime(24048): shutting down vm 05-21 09:25:03.260: w/dalvikvm(24048): threadid=1: thread exiting uncaught exception (group=0x40ca4258) 05-21 09:25:03.283: e/androidruntime(24048): fatal exception: main 05-21 09:25:03.283: e/androidruntime(24048): java.lang.runtimeexception: setparameters failed 05-21 09:25:03.283: e/androidruntime(24048):    @ android.hardware.camera.native_setparameters(native method) 05-21 09:25:03.283: e/androidruntime(24048):    @ android.hardware.camera.setparameters(camera.java:1714) 05-21 09:25:03.283: e/androidruntime(24048):    @ br.com.jairofilho.teste4.login$1.onclick(login.java:66) 


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -