title: I want to record a video in android using media recorder
body: <p>I want record a video using Surface view camera and Media Recorder Here is My Code.... I am getting crash at mediarecorder.prepare() and my default path getting null. please help me ...</p>
  
  <pre><code>private boolean startRecording() {
          try {
          camera.unlock();
          mediaRecorder = new MediaRecorder();
              second=0;
              minute=0;
              recordCountTimer = new CountDownTimer(Long.MAX_VALUE,1000) {
                  @Override
                  public void onTick(long millisUntilFinished) {
                      second++;
                      if(second&gt;=60){
                          second=0;
                          minute++;
                      }
                      recordCount.setText(String.format("%02d:%02d",minute,second));
                  }
  
                  @Override
                  public void onFinish() {
                      finish();
                  }
              }.start();
          mediaRecorder.setCamera(camera);
              mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
              mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
              Log.d(TAG, "A");
  //        mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));
  //        defaultVideoPath= FileManger.getOutputMediaFile(MEDIA_TYPE_VIDEO).getAbsolutePath();
  //        uriVid = Uri.parse(FileManger.getOutputMediaFile(MEDIA_TYPE_VIDEO).getAbsolutePath());
  //        defaultVideoPath = getRealPathFromUri(uriVid);
              CamcorderProfile camcorderProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
              mediaRecorder.setProfile(camcorderProfile);
          mediaRecorder.setOutputFile(defaultVideoPath);
          mediaRecorder.setVideoSize(recordingCameraSurface.getWidth(), recordingCameraSurface.getHeight());
          mediaRecorder.setVideoFrameRate(20);
              Log.v(TAG, "C");
          mediaRecorder.setPreviewDisplay(surfaceHolder.getSurface());
          mediaRecorder.prepare();
              Log.w(TAG, "D");
          mediaRecorder.start();
              Log.e(TAG, "E");
          } catch (IOException e) {
              releaseMediaRecorder();
              return false;
          }catch (IllegalStateException t){
              releaseMediaRecorder();
              return  false;
          }
  
          return true;
      }
  </code></pre>
  
  <p>When I am sending this default video path in intent the path is getting null</p>