Access Device hardware (Camera Flash) Programically ina android
<p>I have one question that can we access android device camera's flash light<br>
  programmically.Is this possible to turn on and off flash light programmically?
  please give me my answer .
  thanks in advance.</p>

<pre><code>    package com.thedevelopersinfo.tutorial.android.soundrecordingexample;

         import java.io.File;

         import android.app.Activity;
       import android.content.ContentResolver;
       import android.content.ContentValues;
     import android.content.Intent;
       import android.hardware.Camera;

     import android.media.MediaRecorder;
      import android.net.Uri;
     import android.os.Bundle;
      import android.os.Environment;
     import android.provider.MediaStore;
     import android.provider.MediaStore.MediaColumns;
      import android.view.View;
     import android.view.View.OnClickListener;
        import android.widget.Button;


         public class Main extends Activity {
    private MediaRecorder mediaRecorder;
    private File file = null;
    static final String PREFIX = "record";
    static final String EXTENSION = ".3gpp";
    private Button b1;
    Camera mCamera;
    public boolean isOn=true;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

         mCamera = Camera.open();

        Camera.Parameters params = mCamera.getParameters();


        b1=(Button)findViewById(R.id.startBtn);
        b1.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub


                 setFlashlight();



            }
        });

    }
    public void setFlashlight()
    {
        if (mCamera == null)
        {

        }
        Camera.Parameters params = mCamera.getParameters();
        String value;
        if (isOn) // we are being ask to turn it on
        {
            value = Camera.Parameters.FLASH_MODE_TORCH;
        }
        else  // we are being asked to turn it off
        {
            value =  Camera.Parameters.FLASH_MODE_AUTO;
        }

        try{    
            params.setFlashMode(value);
            mCamera.setParameters(params);

            String nowMode = mCamera.getParameters().getFlashMode();

            if (isOn)
            {
                 nowMode.equals(Camera.Parameters.FLASH_MODE_TORCH);
            }
            if (!isOn)
            {
                 nowMode.equals(Camera.Parameters.FLASH_MODE_AUTO);
            }

        }
        catch (Exception ex)
        {
        }
        }

}
</code></pre>

<p>but i got following exception
03-10 18:47:34.907: ERROR/QualcommCameraHardware(1280): Parameter AntiBanding is not supported for this sensor</p>
