1. When displaying the video image list and sending a multimedia message, you must display the thumbnail of the video or image when creating a slide. The display code is as follows:
// Import
Import Android. content. contentresolver;
Import Android. content. contenturis;
Import Android. Graphics. Bitmap;
Import Android. provider. mediastore. video;
Import Android. widget. imageview;
// Imageview Control
Private imageview mimagepreview;
//.............................
// Initialize imageview
Mimagepreview = (imageview) findviewbyid (R. Id. image_preview );
// Video is the URI of the video file.
Long id = contenturis. parseid (video );
Contentresolver mcontentresolver = mcontext. getcontentresolver ();
// Thumbnail type: mini_kind full_screen_kind micro_kind
Bitmap minithumb = video. thumbnails. getthumbnail (mcontentresolver, ID,
Video. thumbnails. mini_kind, null );
// Fill the image
Mimagepreview. setimagebitmap (minithumb );
//...............................
Or use
Bitmap bitmap = videoattachmentview. createvideothumbnail (mcontext, video );
2 In Android. provider. mediastore contains various processing classes for images and videos, android. provider. mediastore. images. thumbnails and Android. provider. mediastore. video. thumbnails provides a method for generating thumbnails for images and videos.
3. The image and video indexes and their relationship to the corresponding thumbnails are stored in the DB file in/sdcard/data/COM. Android. providers. Media/databases,
Images and thumbnails
Images
_ Id image ID
_ DATA image path
Thumbnails
_ ID: ID of the thumbnail
_ DATA thumbnail storage location
Image_id corresponds to the source image ID
Video table images and thumbnails
Video
_ Id video ID
_ DATA video path
Videothumbnails
_ ID: ID of the video thumbnail
_ DATA video thumbnail storage location
Image_id corresponds to the video ID
4. Take obtaining the thumbnail of a video as an example. The procedure is as follows:
1. Obtain the video Uri.
2. convert it to string to get the video ID.
3. Go to the videothumbnails table and find the video thumbnail path.
4. Obtain the image by path
5. For more information, see: Get thumbnails of images and videos on Android phones.