Delete Bitmap Android Example

If some memory leak – problem try release of memory used of a big Bitmap what already not to need;

Bitmpap bmp; // not null
bmp.recycle();
bmp = null;
 
final boolean bmpIsRecycled = bmp.isRecycled()
// Returns true if this bitmap has been recycled.

http://developer.android.com/reference/android/graphics/Bitmap.html
Free the native object associated with this bitmap, and clear the reference to the pixel data. This will not free the pixel data synchronously; it simply allows it to be garbage collected if there are no other references. The bitmap is marked as “dead”, meaning it will throw an exception if getPixels() or setPixels() is called, and will draw nothing. This operation cannot be reversed, so it should only be called if you are sure there are no further uses for the bitmap. This is an advanced call, and normally need not be called, since the normal GC process will free up this memory when there are no more references to this bitmap.

This entry was posted in Android Examples Code, Bitmap, drawing and tagged . Bookmark the permalink.


Comments are closed.



9,647 views