Bitmap.Recycle Method

Definition

Immediately releases the pixel data associated with this Bitmap.

[Android.Runtime.Register("recycle", "()V", "")]
public void Recycle();
[<Android.Runtime.Register("recycle", "()V", "")>]
member this.Recycle : unit -> unit
Attributes

Remarks

Immediately releases the pixel data associated with this Bitmap.

Call this method to release a Bitmap that is certainly no longer needed, such as with a Bitmap that was created as an intermediate buffer in a transformation. Calling this method will release the pixel memory immediately, rather than wait for a future Garbage Collection.

Avoid calling this method on Bitmaps that were used in a View or that may be referenced elsewhere, as it may be unsafe.

After calling this method, any subsequent attempt to access the bitmap's pixel data (e.g., using getPixels() or setPixels()) will throw an exception, and the bitmap will draw nothing. This operation cannot be reversed.

Java documentation for android.graphics.Bitmap.recycle().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to