Class BitmapManager


  • public class BitmapManager
    extends java.lang.Object
    Asynchronous bitmap manager that loads and saves bitmaps. The manager uses a LruCache to cache the bitmaps for better performance.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static BitmapManager get()
      Return a bitmap manager instance.
      void load​(android.content.Context context, android.net.Uri uri, int width, int height, BitmapManager.LoadCallback callback)
      Load the uri and downsample the bitmap, adjusting it to the specified dimensions.
      void save​(android.content.Context context, android.graphics.Bitmap bitmap, BitmapManager.SaveCallback callback)
      Save the bitmap into a file
      void thumbnail​(android.content.Context context, android.net.Uri uri, int width, int height, BitmapManager.LoadCallback callback)
      Get a video file's thumbnail.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • get

        public static BitmapManager get()
        Return a bitmap manager instance.
      • load

        public void load​(android.content.Context context,
                         android.net.Uri uri,
                         int width,
                         int height,
                         BitmapManager.LoadCallback callback)
        Load the uri and downsample the bitmap, adjusting it to the specified dimensions.
        Parameters:
        context - Android context
        uri - Uri of the image to be loaded
        width - Width for the output bitmap to be adjusted to (not necessarily exact fit).
        height - Height for the output bitmap to be adjusted to (not necessarily exact fit).
        callback - The callback to be called when loading the bitmap.
      • thumbnail

        public void thumbnail​(android.content.Context context,
                              android.net.Uri uri,
                              int width,
                              int height,
                              BitmapManager.LoadCallback callback)
        Get a video file's thumbnail.
        Parameters:
        context - Android context.
        uri - Uri of the video file.
        width - Thumbnail's width.
        height - Thumbnail's height.
        callback - The callback to be called when loading the thumbnail.
      • save

        public void save​(android.content.Context context,
                         android.graphics.Bitmap bitmap,
                         BitmapManager.SaveCallback callback)
        Save the bitmap into a file
        Parameters:
        context - Android context.
        bitmap - Bitmap to save.
        callback - the callback to be called when saving the bitmap.