What does Bitmap#recycle() in Android Honeycomb actually DO?

后端 未结 3 1671
無奈伤痛
無奈伤痛 2020-12-15 22:30

I am writing a very memory intensive application for Android Honeycomb, and I\'ve been very careful to recycle() unused Bitmaps wherever possible;

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 23:04

    I have discovered that, in Honeycomb onwards, if an ImageView contains a Bitmap that has been recycled, the Bitmap data is still retained in memory until setImageBitmap(null) is called on the ImageView. This may even be the case if setImageResource(...) or setImageDrawable(...) are called (in this case, a very large bitmap was replaced with a fairly small nine-patch, but only when setImageBitmap(null) was called before loading the nine-patch was the memory actually disposed).

提交回复
热议问题