Null Pointer exception when initating camera led
<p>I get a null pointer exception when trying to initiate this class that tries to turn on the camera LED on my Galaxy Nexus with 4.1.2:
    package com.quinny898.doorcontrol;</p>

<pre><code>import android.app.*;
import android.content.*;
import android.hardware.*;
import android.os.*;
import android.view.*;
import com.quinny898.gcse.doorcontrol.*;
import java.util.*;

import com.quinny898.gcse.doorcontrol.R;

public class DoorControlDoing extends Activity {
    /** Called when the activity is first created. */


//Create camera and parameter objects
    private Camera mCamera;
    private Camera.Parameters mParameters;
    private boolean mbTorchEnabled = false;

    @Override

    public void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.doing);
        if(mCamera != null){
            mCamera.release();
        }
//... later in a click handler or other location, assuming that the mCamera object has already been instantiated with Camera.open()
    mParameters = mCamera.getParameters();
//Get supported flash modes
    List flashModes = mParameters.getSupportedFlashModes ();
//Make sure that torch mode is supported
//EDIT - wrong and dangerous to check for torch support this way
//if(flashModes != null &amp;&amp; flashModes.contains("torch")){
    if(flashModes != null &amp;&amp; flashModes.contains(Camera.Parameters.FLASH_MODE_TORCH)){
        if(mbTorchEnabled){
        //Set the flash parameter to off
    mParameters.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
        }
        else{
//Set the flash parameter to use the torch
mParameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);}
//Commit the camera parameters
mCamera.setParameters(mParameters);
mbTorchEnabled = !mbTorchEnabled;
}}



        public void onBackPressed(){
            return;
        }


        public void restart(View view) {
            Intent myIntent = new Intent(DoorControlDoing.this,
                       DoorControlActivity.class); 
                       DoorControlDoing.this.startActivity(myIntent);
        }

        public void exit(View view) {
         Intent intent = new
         Intent(Intent.ACTION_MAIN);
         intent.addCategory(Intent.CATEGORY_HOME);
         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         startActivity(intent);
        }




}
</code></pre>

<p>Any ideas? It's probably something stupid, but anyway...
Thanks</p>
