1

For an app I'm developing I have a GridLayout (not a GridView), which I populate dynamically with images. I could just load all the images at once (which is what I do now), but I do not have any guarantees on the amount of images or the amount of memory a device has. To account for this, and to still keep an optimal UI experience (no hanging) I thought it would be best to determine the amount of memory a device has, and for example say that my app can use half of the available memory to hold images. I would then use this maximum amount of images and tell my app to load half of this maximum amount of the images in both directions extending from the current scroll position. Do you guys know of a proper way to approach this? I'm kind of stumped and could really use some help getting started.

Zero
  • 1,864
  • 3
  • 21
  • 39

1 Answers1

1

I've had such problem (need to load more than 100 high-res images to ListView and cache them). I've used DiskLruCache library (https://github.com/JakeWharton/DiskLruCache) for it in a way described here:

Using DiskLruCache in android 4.0 does not provide for openCache method

Works perfectly.

Community
  • 1
  • 1
Rodion Altshuler
  • 1,713
  • 1
  • 15
  • 31