3

Kind of new to caching of bitmap for android. Would like to ask a few questions. Do you guys have sample code of caching an image and retriving an image from cache. How do the codes know once the cache is being overridden?

Macarse
  • 91,829
  • 44
  • 175
  • 230
ericlee
  • 2,703
  • 11
  • 43
  • 68
  • And what kind of cache is it you want? A memory cache for decoded images or a file cache for downloaded images? (Or parhaps a combo of them both?) – H9kDroid Nov 14 '11 at 21:18
  • wow? Whats the different between a memory cache and a file cache? i'm using mainly for caching image downloaded from web so that i can pass around activity – ericlee Nov 14 '11 at 22:00
  • If you store a file as a file cache it will be written on nand memory and it will be stored if you close application :), but that will not happen for a memory cache, since all the objects are marked for garbage collection if app is closed – Aurelian Cotuna Nov 14 '11 at 22:09
  • Hey man thanks! Do you have any tutorial for memory cache? Most likely will use memory cache as it should only be stored on runtime :). If user reopen the bitmap might have been changed – ericlee Nov 15 '11 at 08:41

1 Answers1

2

There is a question similar to this: give it a look here Android image caching . You will see there an elegant method to solve your problem :)

Community
  • 1
  • 1
Aurelian Cotuna
  • 3,076
  • 3
  • 29
  • 49