I am trying to get the path of the video file for a video thumbnail. I\'m not sure why it is still coming as null after I modified based on some solutions here. The version of a
and summons a gallery of videos
No, it does not. It allows the user to choose from any activity that supports ACTION_GET_CONTENT
for a MIME type of video/*
. The Uri
that you get back can be from anything, not necessarily a "gallery" app, and not necessarily one that points to a file. The Uri
could point to:
BLOB
column in a databaseThe method to get the path of the video file
The only values you can get back from that query()
, reliably, are the OpenableColumns
, for the size and "display name" of the content.
You need to either:
Use a thumbnail engine that accepts a content
Uri
as a parameter, or
Use ContentResolver
and openInputStream()
to get an InputStream
on the content, then use some thumbnail engine that accepts an InputStream
as a parameter, or
Use ContentResolver
and openInputStream()
to get an InputStream
on the content, then use that stream to make your own file that contains a copy of the bytes from the content, so you can use your own file with some thumbnail engine that requires a file, or
Do not use ACTION_GET_CONTENT
, but instead render your own "chooser" UI by asking the MediaStore
for all videos, as you can get thumbnails of those videos from MediaStore
(see this sample app)