0

I'm BitmapFactory.decodeResourcing and then scaling jpg images (600x400) stored in /res for use in an animation on the canvas. The animation is quick and beautiful because the bitmaps are used directly after decoding.

Would writing and reading these bitmaps from cache or from an internal storage file work as fast and efficiently as they do when used directly after decoding?

In other words, are bitmaps decoded again when read from cache or an internal storage file?

Do cache and internal storage files have the same 16-24MB limit that heap memory has?

Are they the same thing?

trincot
  • 317,000
  • 35
  • 244
  • 286

1 Answers1

0

I think that reading from /res and an internal storage folder would be equivalent.

I'm not sure what you're referring to by "cache" however. If you're talking about keeping the bitmaps in memory instead of decoding it, then I would think that would be much faster.

Matthew
  • 44,826
  • 10
  • 98
  • 87
  • Caching, for example, to a hashmap as suggested in the "strange memory error" thread http://stackoverflow.com/questions/477572/android-strange-out-of-memory-issue – dreamincode Mar 11 '11 at 23:36
  • Ah, yes, keeping things in memory is faster, but you have to limit your memory usage. What you are calling cache is heap memory. – Matthew Mar 11 '11 at 23:46
  • Cool, that answers my question. But raises another. Can I write the raw bitmap to the sdcard, so it doesnt have to be decoded again with BitmapFactory.decodeFile? – dreamincode Mar 12 '11 at 00:03
  • Hmm, I think it's faster to decode than to read back bits from flash memory. Not sure though. – Matthew Mar 12 '11 at 01:04