in my application I need to display the thumb nail of the video, which is stored in the res / raw folder. I was looking for him. I get the following code.
int id = **"The Video 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);
With this code, I get a thumb from the SD card. but the video from the res / raw folder doesn’t show the thumb in it. I tried a lot of time, but I could not find a solution. I tried as follows.
I create an array and save the resource identifier (Ex:) int[] videoid={R.raw.vi1,...}and place the identifier inMediaStore.Video.Thumbnails.getThumbnail(crThumb, videoid[position], MediaStore.Video.Thumbnails.MICRO_KIND, options);.
Please help me. thanks in advance.
source
share