title: how to view video in activity that is chosen from the gallery
body: <p>I am implementing video uploading functionality in an android application.I can choose a video from gallery but I can not view it in my activity.I dont know how to put a video from gallery to videoview of an activity
  My code to select video from gallery is :</p>
  
  <pre><code>mChoose.setOnClickListener(new View.OnClickListener() 
      {
          @Override
          public void onClick(View v) 
          {
              Intent intent = new Intent();
              intent.setAction(Intent.ACTION_GET_CONTENT);
              intent.addCategory(Intent.CATEGORY_OPENABLE);
              intent.setType("video/*");
              startActivityForResult(intent, REQUEST_ID);
          }
      });
  </code></pre>
  
  <p>onActivityResult Method code</p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) 
  {
      InputStream stream = null;
      if(requestCode == REQUEST_ID &amp;&amp; resultCode == Activity.RESULT_OK)
      {
          try
          {
              stream = getContentResolver().openInputStream(data.getData());
              //System.out.println(data.getData());
              mVideo.setVideoPath(path);
              path = getRealPathFromURI(getApplicationContext(), data.getData());
              //getRealPathFromURI is method in class to obtain path from uri
              System.out.println(path);
  
          }
          catch(Exception ex)
          {
              ex.printStackTrace();
          }
          if(stream != null)
          {
              try
              {
                  stream.close();
              }
              catch(Exception ex)
              {
                  ex.printStackTrace();
              }
          }
      }
  }
  </code></pre>