Bitmap recycle () in java Android

Need help understanding the recycle () method of the Bitmap class.

If I have Bitmap [] named "bmp", for example, what is the difference between execution

Bitmap[i].recycle()

AND

Bitmap[i]=null;

Which is the best option? Should I call both?

thank

+5
source share
3 answers

According to this question, raster data is stored in its own memory, and not in a bunch of Dalvik. You must call recycle()to free up the memory that the bitmap is stored as soon as you are done with it. It is good practice to set its null value after this, although this is somewhat redundant.

. api: http://developer.android.com/reference/android/graphics/Bitmap.html#recycle()

+4

, , , null - .

+3

Android, ", .

0

All Articles