title: Android: Record using default video recorder and return the sd card path
body: <p>I'm trying to develop an application which records the video using default application and writes to sd card and then return the sd card path to previous activity. Why it is not working for me?? i'm getting cancelled toast all the time when I click back button in the camera.</p>
  
  <pre><code>public class AndroidVideoActivity extends Activity {
      final static int REQUEST_VIDEO_CAPTURED = 1;
      Uri uriVideo = null;
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          Button btnVideoRecorder = (Button) findViewById(R.id.buttonClick);
          btnVideoRecorder.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  Intent intent = new Intent("android.media.action.VIDEO_CAMERA");
                  startActivityForResult(intent, REQUEST_VIDEO_CAPTURED);
              }
          });
  
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          // TODO Auto-generated method stub
          if (resultCode == RESULT_OK) {
              if (requestCode == REQUEST_VIDEO_CAPTURED) {
                  uriVideo = data.getData();
                  Toast.makeText(AndroidVideoActivity.this, uriVideo.getPath(),
                          Toast.LENGTH_LONG).show();
              }
          } else if (resultCode == RESULT_CANCELED) {
              uriVideo = null;
              Toast.makeText(AndroidVideoActivity.this, "Cancelled!",
                      Toast.LENGTH_LONG).show();
          }
  
      }
  }
  </code></pre>