Caching generated QR Code

Posted by Michal K on Stack Overflow See other posts from Stack Overflow or by Michal K
Published on 2012-04-12T17:07:47Z Indexed on 2012/04/12 17:28 UTC
Read the original article Hit count: 305

Filed under:
|
|

I use zxing to encode a qr code and store it as a bitmap and then show it in ImageView. Since the image generation time is significant I'm planning to move it to a separate thread (AsyncTaskLoader will be fine I think).

The problem is - it's an image and I know that to avoid memory leaks one should never store a strong reference to it in an Activity.

So how would you do it? How to cache an image to survive config changes (phone rotation) and generally avoid generating it onCreate()?

Just point me in the right direction, please.

© Stack Overflow or respective owner

Related posts about android

Related posts about caching