• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to recycle drawables inflated from XML (since Lollipop update)  RSS feed

Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Prior to Lollipop I was doing the following ('bd' and 'backgrounds' are both declared prior (not shown here)):

This did work great, however since updating my Nexus 10 to Lollipop, this no longer works correctly.

When I exit and re-launch my app, sometimes, the bitmap (backgrounds) is, by all accounts, already recycled (even before I've actually called recycle on it - as if its remembering being recycled from the last time the app was launched).

This bitmap is being applied as a texture to Open GL Quads, so as soon as this has been done, they are no longer required. They are also pretty big so I really want to get rid of them.

Why does this happen? How do I correctly recycle these types of bitmaps (from XML)? If I get it via BitmapFactory all is OK, however, in my case, BitmapFactory unfortunately isn't an option.

Thanks all - hope someone can advise
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!