I want to select a video from my Gallery. It\'s working fine. But now I want to display a Bitmap, as a thumbnail.I tired this code it\'s not working, it always says: NullPoi
createVideoThumbnail() needs the file path, not the content uri. If you're getting null responses, it may be from using the content uri (though the assumption in ThumbnailsUtils.java is of a corrupt video file). When I fixed that, then I was getting permissions errors.
I was able to get the file path from the content uri using the video's ID like this:
val selection = MediaStore.Video.Media._ID + " = $id"
val cursor =
this.contentResolver.query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, null,
selection, null, null)
And then continue on with the cursor as in the other answers in SO.
Docs for contentResolver.query()