title: Getting the video path of capture video using default camera in android
body: <p>I am declaring a global variable for String selectedImagePath. On button click I am  calling video capture code </p>
  
  <pre><code>Intent intent=new Intent("android.media.action.VIDEO_CAPTURE");
  intent.putExtra("android.intent.extra.durationLimit", 120);  
  startActivityForResult(intent, REQUEST_VIDEO_CAPTURED);
  </code></pre>
  
  <p>OnActivity result I am getting video path 
             <code>selectedImagePath = getPath(selectedImageUri);</code></p>
  
  <p>onActivityResult Code 
  <strong><em></strong>  I am getting the value here properly</em></p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data)
  {
   // TODO Auto-generated method stub
  
   if(resultCode==RESULT_OK)
   {
    if(requestCode==REQUEST_VIDEO_CAPTURED)
    {
        Toast.makeText(VideoPostActivity.this, "Video Recorded", Toast.LENGTH_LONG).show();
        Uri selectedImageUri = data.getData();   
  
         selectedImagePath = getPath(selectedImageUri);
  
         System.out.println("selected image path"+selectedImagePath);
  
        /* imgPublishVideo.setEnabled(true);
            imgRecordVideo.setEnabled(false);*/
  
  
  
  
  
    }
  
  
   }
    if(resultCode == RESULT_CANCELED)
   {
   Toast.makeText(VideoPostActivity.this,  "Cancelled!",  Toast.LENGTH_LONG).show();
  
   }
  
  
   }
  </code></pre>
  
  <p>I am not getting value here</p>
  
  <pre><code>SetMyVideoPostAsyncTask myVideoPostAsyncTask=new SetMyVideoPostAsyncTask(VideoPostActivity.this,videoTitle,videoComment,selectedImagePath);
  myVideoPostAsyncTask.execute();
  
  public String getPath(Uri uri)
  {       
          String[] projection = { MediaStore.Images.Media.DATA };        
          Cursor cursor = managedQuery(uri, projection, null, null, null);        
          if(cursor!=null)         
          {            
  
              int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);          
              cursor.moveToFirst();          
              return cursor.getString(column_index);       
              }       
          else 
              return null;    
  }
  </code></pre>
  
  <p>but I am not able to pass selectedImagePath value from activity it is going null can anybody tell what is problem? What do I do?</p>