0

I asked this previous question and have edited it to suit my code for a Video Player running from an intent

videoURI = getIntent().getData();
vv.setVideoURI(videoURI);

but this gives me a blank string when I test it with setText()

How do I get this to work so I can get the full path for the launched video? EG. /storage/extSdCard/Videos/Video.mp4

My Code:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    Uri uri = data.getData();
    String[] filePathColumn = { MediaStore.Video.Media.DATA };

    Cursor cursor = getContentResolver().query(uri,
            filePathColumn, null, null, null);
    cursor.moveToFirst();

    int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
    path = cursor.getString(columnIndex);

    cursor.close();
}
Community
  • 1
  • 1
Timmo
  • 2,266
  • 4
  • 34
  • 54

1 Answers1

0

Use MediaStore.Video.VideoColumns.DATA instead of MediaStore.Video.Media.DATA

Tarsem Singh
  • 14,139
  • 7
  • 51
  • 71
  • String[] filePathColumn = { MediaStore.Video.VideoColumns.DATA }; debug after this line using Log.d("mytest path etc",filePathColumn[0]); and see result ? – Tarsem Singh Jul 13 '13 at 22:19