Video Thumbnails from the Media Store

We could, starting with Android 2.0 (API Level 5), pull out the thumbnails associated with each video file from within the loop. We need the ID of the video file that is in our list of columns to select (MediaStore.Video.Media._ID), which we can then use in the "where" clause of the managedQuery.

int id = cursor.getInt(cursor.getColumnIndex(MediaStore.Video.Media._ID)); String[] thumbColumns = { MediaStore.Video.Thumbnails.DATA,

MediaStore.Video.Thumbnails.VIDEO_ID}; Cursor thumbCursor = managedQuery(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI,^ thumbColumns, MediaStore.Video.Thumbnails.VIDEO_ID + "=" + id, null, null); if (thumbCursor.moveToFirst()) {

Log.v("VideoGallery",thumbCursor.getColumnIndex(MediaStore.Video.Thumbnails.DATA));

Was this article helpful?

0 0

Post a comment