As part of my android application development study, I developed a simple SOS application by accessing LED Flash light. Every thing working fine and LED blinking at the interval of 1/2 seconds. But When user press the back button in phone, the application get quit and after 1/2 second a "Crash/Force Close" message coming. I am a noob to android development and whats wrong with my code ?
private boolean lOn=true;
    Timer mTimer = new Timer();
    TimerTask mTimerTask = new TimerTask() {
        @Override
        public void run() {
            if(lOn){
                final Parameters p = camera.getParameters();
                Log.i("info", "torch is turn Off!");
                p.setFlashMode(Parameters.FLASH_MODE_TORCH);
                camera.setParameters(p);
                camera.startPreview();
                lOn=false;
            }
            else {
                final Parameters p = camera.getParameters();
                p.setFlashMode(Parameters.FLASH_MODE_OFF);
                camera.setParameters(p);
                camera.stopPreview();
                isLighOn = false;
                lOn=true;
            }
        }
    };