|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BitmapPool
An interface for a pool that allows users to reuse Bitmap
objects.
Method Summary | |
---|---|
void |
clearMemory()
Removes all Bitmap s from the pool. |
Bitmap |
get(int width,
int height,
Bitmap.Config config)
Returns a Bitmap of exactly the given width, height, and configuration,
or null if no such Bitmap could be obtained from the pool. |
boolean |
put(Bitmap bitmap)
Adds the given Bitmap and returns true if the Bitmap
was eligible to be added and false otherwise. |
void |
setSizeMultiplier(float sizeMultiplier)
Multiplies the initial size of the pool by the given multipler to dynamically and synchronously allow users to adjust the size of the pool. |
void |
trimMemory(int level)
Reduces the size of the cache by evicting items based on the given level. |
Method Detail |
---|
void setSizeMultiplier(float sizeMultiplier)
If the current total size of the pool is larger than the max size after the given multiplier is applied,
Bitmap
s should be evicted until the pool is smaller than the new max size.
sizeMultiplier
- The size multiplier to apply between 0 and 1.boolean put(Bitmap bitmap)
Bitmap
and returns true
if the Bitmap
was eligible to be added and false
otherwise.
Note - If the Bitmap
is rejected (this method returns false) then it is the caller's
responsibility to call Bitmap.recycle()
.
Note - This method will return true
if the given Bitmap
is synchronously
evicted after being accepted. The only time this method will return false
is if the
Bitmap
is not eligible to be added to the pool (either it is not mutable or it is
larger than the max pool size).
bitmap
- The Bitmap
to attempt to add.Bitmap.isMutable()
,
Bitmap.recycle()
Bitmap get(int width, int height, Bitmap.Config config)
Bitmap
of exactly the given width, height, and configuration,
or null if no such Bitmap
could be obtained from the pool.
width
- The width of the desired Bitmap
.height
- The height of the desired Bitmap
.config
- The Bitmap.Config
of the desired Bitmap
.void clearMemory()
Bitmap
s from the pool.
void trimMemory(int level)
level
- The level from ComponentCallbacks2
to use to determine how many
Bitmap
s to evict.ComponentCallbacks2
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |