display video thumbnails from sdcard in android [duplicate]
Possible Duplicate:
How to get thumbnail for video in my /sdcard/Android/data/mypackage/files folder ?
Hello All
开发者_运维知识库In my android application i am recording a video and saving this in sdcard. Now what i require is display this video as thumbnails in my application.
I tried all solutions from Android: Is it possible to display video thumbnails? The issue is i need the video from sdcard path and am not understanding as how to get it.
I tried below code
int id = **"The Video's ID"**
ImageView iv = (ImageView ) convertView.findViewById(R.id.imagePreview);
ContentResolver crThumb = getContentResolver();
BitmapFactory.Options options=new BitmapFactory.Options();
options.inSampleSize = 1;
Bitmap curThumb = MediaStore.Video.Thumbnails.getThumbnail(crThumb, id,MediaStore.Video.Thumbnails.MICRO_KIND, options);
iv.setImageBitmap(curThumb);
But could not understand as how to get the video from sdcard path.
Please share your valuable suggestions
Thanks in advance :)
You can check out ThumbnailUtils
as per this answer, provided you are on Android 8 (Froyo) or later.
精彩评论