public void startRecorder(String fileName) {
    recorderInstance = new SpeexRecorder(fileName);
    Thread th = new Thread(recorderInstance);
    th.start();

    recorderInstance.setRecording(true);

    status = RECORDING;
  }
 public void stopRecorder() {
   if (recorderInstance != null) {
     if (recorderInstance.isRecording()) recorderInstance.setRecording(false);
   }
   status = STOPPED;
 }