Media Store for Retrieving Video


To query the MediaStore for video content, we utilize the Uri specified in the constant MediaStore.Video.Media.EXTERNAL_CONTENT_URI as the data source for a query.

Cursor cursor = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,^ mediaColumns, null, null, null);

In return we get a cursor that we can loop through and extract the data.

Log.v("VideoGallery", cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.DATA)); Log.v("VideoGallery", cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.TITLE)); Log.v("VideoGallery", cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.MIME_TYPE)); } while (cursor.moveToNext());

Was this article helpful?

0 0

Post a comment