Android: Get thumbnail of image on SD card, given Uri of original image

Rahat Ahmed picture Rahat Ahmed · Feb 6, 2011 · Viewed 53.2k times · Source

So i've got a Uri of an image the user chooses out of images off his SD card. And i'd like to display a thumbnail of that image, because obviously, the image could be huge and take up the whole screen. Anyone know how?

Answer

sujith s picture sujith s · Apr 1, 2015

You can simply create thumbnail video and image using ThumnailUtil class of java

Bitmap resized = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(file.getPath()), width, height);


 public static Bitmap createVideoThumbnail (String filePath, int kind)

Added in API level 8 Create a video thumbnail for a video. May return null if the video is corrupt or the format is not supported.

Parameters filePath the path of video file kind could be MINI_KIND or MICRO_KIND

For more Source code of Thumbnail Util class

Developer.android.com