code: public static Bitmap getThumbnail(Context context, Uri uri, String mimeType) {
          if (DEBUG)
              Log.d(TAG, "Attempting to get thumbnail");
  
          if (!isMediaUri(uri)) {
              Log.e(TAG, "You can only retrieve thumbnails for images and videos.");
              return null;
          }
  
          Bitmap bm = null;
          if (uri != null) {
              final ContentResolver resolver = context.getContentResolver();
              Cursor cursor = null;
              try {
                  cursor = resolver.query(uri, null, null, null, null);
                  if (cursor.moveToFirst()) {
                      final int id = cursor.getInt(0);
                      if (DEBUG)
                          Log.d(TAG, "Got thumb ID: " + id);
  
                      if (mimeType.contains("video")) {
                          bm = MediaStore.Video.Thumbnails.getThumbnail(
                                  resolver,
                                  id,
                                  MediaStore.Video.Thumbnails.MINI_KIND,
                                  null);
                      }
                      else if (mimeType.contains(FileUtils.MIME_TYPE_IMAGE)) {
                          bm = MediaStore.Images.Thumbnails.getThumbnail(
                                  resolver,
                                  id,
                                  MediaStore.Images.Thumbnails.MINI_KIND,
                                  null);
                      }
                  }
              } catch (Exception e) {
                  if (DEBUG)
                      Log.e(TAG, "getThumbnail", e);
              } finally {
                  if (cursor != null)
                      cursor.close();
              }
          }
          return bm;
      }
docs: Attempt to retrieve the thumbnail of given Uri from the MediaStore. This
  should not be called on the UI thread.
  
  @param context
  @param uri
  @param mimeType
  @return
  @author paulburke