I want to make app similar to this.
I know how to make everything, but don't know proper way to handle 1000+ HD images without triggering Out Of Memory error.
Can anyone recommend way how to load and release images by releasing memory they occupied?
I know for that, but problem is even when you resize image. Loading 1000+ or 5000+ will trigger OOM even images is not HD or they are resized. I can see in Android Monitor how app use more and more memory for every new loaded image in same ImageView.
Loading different image in same ImageView leave reference "live" from previous loaded image. As I continue to load different image in same ImageView, memory consumption start to grow as reference for every loaded image is still "live". I need a way to "break" reference from previous loaded image in that particular ImageView.
As I continue to load different image in same ImageView, memory consumption start to grow as reference for every loaded image is still "live". I need a way to "break" reference from previous loaded image in that particular ImageView.
The question is, has your application died because of too many images? What makes you think that the image is "live". Java and most likely Android's Dalvik/ART are lazy in collecting garbage (only doing it when forced to).
See Erel's example here, using the xCustomListView you can load many images but, the trick there is that it will only load the images within the Visible Range, this speeds loading images tremendously and at the same time it saves resources, this will help in your situation.
Everybody tried to help you in 1000+ images problem. But problem was some where else. Will you please elaborate the problem and the solution. This may help newbies like me.
Everybody tried to help you in 1000+ images problem. But problem was some where else. Will you please elaborate the problem and the solution. This may help newbies like me.