title: how to pick a video file from gallery SDcard and play it in App view?
body: <p>i've to pick a video from gallery and play it but i can't play it but for image i got it as like that i'ad tried for video also but it goes some where wrong if some have any idea please help me guys.</p>
  
  <p>here is my code but it is not working,</p>
  
  <pre><code>import android.app.Activity;
  import android.content.Intent;
  import android.database.Cursor;
  import android.net.Uri;
  import android.os.Bundle;
  import android.provider.MediaStore;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.VideoView;
  
  public class videoView extends Activity implements OnClickListener {
  
       private VideoView videoPreview;
  Button button;
  private static final int SELECT_VIDEO_REQUEST = 1;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.videoview);
  
          button  = (Button) findViewById(R.id.button1);
          button.setOnClickListener((OnClickListener) this);
  }
      public void onClick(View v) {
          if(v ==button){
  
              Intent intent = new Intent(
                      Intent.ACTION_PICK,
                      android.provider.MediaStore.Video.Media.EXTERNAL_CONTENT_URI);
          startActivityForResult(intent, SELECT_VIDEO_REQUEST);
  
      }}
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      if (requestCode == SELECT_VIDEO_REQUEST &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) {
          Uri selectedImage = data.getData();
          String[] filePathColumn = { MediaStore.Video.Media.DATA };
  
          Cursor cursor = getContentResolver().query(selectedImage,
                  filePathColumn, null, null, null);
          cursor.moveToFirst();
  
          int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
          String picturePath = cursor.getString(columnIndex); 
          cursor.close();
  
           videoPreview = (VideoView) findViewById(R.id.videoPreview);
           videoPreview.setVideoPath(picturePath);
  }
  }}
  </code></pre>