getThumbnailBitmap
Returns a Bitmap resized / re-sampled to meet the required minimumImageSizeInPx to display, but to not be too large to improve performance.
Use the minimumImageSizeInPx best with the size in pixels of your ImageView you are going to display the image in:
int width = imageView.getWidth();
int height = imageView.getHeight();
int maxDimension = Math.max(width, height);
Bitmap bitmap = mediaItemSource.getThumbnailBitmap(context, maxDimension);
Return
A Bitmap that contains a thumbnail for the respective MediaItem
Parameters
any Context, is used to get a ContentResolver.
The minimum size in pixel (width and/or height) the returned Bitmap is going to be displayed on. This is internally used in order to adapt the inSampleSize of the Bitmap in order to improve performance. If null
is passed, no resizing / resampling is going to be performed.
Throws
May throw RuntimeExceptions when media could not be retrieved / no media file has been found for the given mediaItem (e.g. just about to be stored). In short: library consumers should handle when this method throws an Exception.