Camera flashlight project has stopped while clicking
<p>I am working with camera flashlight project.</p>

<p>It load on the emulator but when I click on the "On" button it has stopped unexpectedly. Here is the cat-log <a href="https://dl.dropbox.com/u/15065300/logcat1.png" rel="nofollow">https://dl.dropbox.com/u/15065300/logcat1.png</a> </p>

<p>Here is the code:</p>

<pre><code>public class FlashLight extends Activity {


    private final static String LOG_TAG = "FlashLight";  
    private Button mOnBtn;   
    private Camera mCamera;    
    private boolean isActive;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

      //this will be inside your onCreate...
        mOnBtn = (Button) findViewById(R.id.on_btn);
        mOnBtn.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                flipSwitch();
                processClick();

            }
        });
   }

    //these will be outside your onCreate
    public void flipSwitch() {
        isActive = !isActive;
    }

    @Override
    protected void onResume() {
        super.onResume();
        try{
            mCamera = Camera.open();
            mCamera.startPreview();
            Toast.makeText(getApplicationContext(),"Camera is  present", Toast.LENGTH_LONG).show();

        } catch( Exception e ){
            Log.e(LOG_TAG, "Impossible d'ouvrir la camera");
        }
    }

    @Override
    protected void onPause() {
        if( mCamera != null ){
            mCamera.release();
            mCamera = null;
        }
        super.onPause();
    }

    public void processClick() {
        if(isActive) {
            Parameters params = mCamera.getParameters();
            params.set("flash-mode", "torch");
            mCamera.setParameters( params );
            mCamera.startPreview();
        }

        else { 

             Parameters params = mCamera.getParameters();
             params.set("flash-mode", "off");
             mCamera.setParameters( params );
             mCamera.stopPreview();

        }
    }
}
</code></pre>
