Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If I understand correctly, you have images and videos served by content provider and accessible as URIs. You want to create thumbnails for such images and videos.</p> <p>I don't know how to do this with video files, but this is how I will implement it with image files.</p> <ol> <li><p>Open the image as InputStream using ContentResolver's openInputStream method. <a href="http://developer.android.com/reference/android/content/ContentResolver.html#openInputStream%28android.net.Uri%29" rel="nofollow noreferrer">http://developer.android.com/reference/android/content/ContentResolver.html#openInputStream%28android.net.Uri%29</a></p></li> <li><p>Create a BitmapDrawable with the above InputStream using this method <a href="http://developer.android.com/reference/android/graphics/drawable/BitmapDrawable.html#BitmapDrawable%28android.content.res.Resources,%20java.io.InputStream%29" rel="nofollow noreferrer">http://developer.android.com/reference/android/graphics/drawable/BitmapDrawable.html#BitmapDrawable%28android.content.res.Resources,%20java.io.InputStream%29</a></p></li> <li><p>Scale down the BitmapDrawable to desired width and height of thumbnail. Follow this tutorial. <a href="http://www.anddev.org/resize_and_rotate_image_-_example-t621.html" rel="nofollow noreferrer">http://www.anddev.org/resize_and_rotate_image_-_example-t621.html</a></p></li> <li><p>[Optional] You may want to cache the thumbnail, so that you don't have to repeat above steps everytime the user accesses your Gallery.</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload