com.herroworld.imagegrabber
Class ImageCache

java.lang.Object
  extended by com.herroworld.imagegrabber.ImageCache

public class ImageCache
extends java.lang.Object

This class holds our bitmap caches (memory and disk).


Nested Class Summary
static class ImageCache.ImageCacheParams
          A holder class that contains cache parameters.
 
Constructor Summary
ImageCache(Context context, ImageCache.ImageCacheParams cacheParams)
          Creating a new ImageCache object using the specified parameters.
ImageCache(Context context, java.lang.String uniqueName)
          Creating a new ImageCache object using the default parameters.
 
Method Summary
 void addBitmapToCache(java.lang.String data, Bitmap bitmap)
           
 void clearCaches()
           
 Bitmap getBitmapFromDiskCache(java.lang.String data)
          Get from disk cache.
 Bitmap getBitmapFromMemCache(java.lang.String data)
          Get from memory cache.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageCache

public ImageCache(Context context,
                  ImageCache.ImageCacheParams cacheParams)
Creating a new ImageCache object using the specified parameters.

Parameters:
context - The context to use
cacheParams - The cache parameters to use to initialize the cache

ImageCache

public ImageCache(Context context,
                  java.lang.String uniqueName)
Creating a new ImageCache object using the default parameters.

Parameters:
context - The context to use
uniqueName - A unique name that will be appended to the cache directory
Method Detail

addBitmapToCache

public void addBitmapToCache(java.lang.String data,
                             Bitmap bitmap)

getBitmapFromMemCache

public Bitmap getBitmapFromMemCache(java.lang.String data)
Get from memory cache.

Parameters:
data - Unique identifier for which item to get
Returns:
The bitmap if found in cache, null otherwise

getBitmapFromDiskCache

public Bitmap getBitmapFromDiskCache(java.lang.String data)
Get from disk cache.

Parameters:
data - Unique identifier for which item to get
Returns:
The bitmap if found in cache, null otherwise

clearCaches

public void clearCaches()