title: Set flash mode in android
body: <p>I got some example to set flash mode, cant make it work. I using it in a camera swap:</p>
  
  <pre><code>        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();
              }
          }
      });
  </code></pre>
  
  <p>Without the flash parameters, swap works fine.</p>
  
  <p>Included in the manifest the permission:</p>
  
  <p><code>&lt;uses-feature android:name="android.hardware.camera" /&gt;
      &lt;uses-feature android:name="android.hardware.camera.autofocus" /&gt;
      &lt;uses-feature android:name="android.hardware.camera.flash" /&gt;
      &lt;uses-permission android:name="android.permission.CAMERA" /&gt;</code></p>
  
  <p>But log returns:</p>
  
  <pre><code>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 with 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):    at android.hardware.Camera.native_setParameters(Native Method)
  05-21 09:25:03.283: E/AndroidRuntime(24048):    at android.hardware.Camera.setParameters(Camera.java:1714)
  05-21 09:25:03.283: E/AndroidRuntime(24048):    at br.com.JairoFilho.teste4.Login$1.onClick(Login.java:66)
  </code></pre>