0

I'm developing some application where requires downloading many posts from server. List item contain some text information, user pic & image is inserted into the message.

For updating listview I'm using PullToRefreshListView from there https://github.com/chrisbanes/Android-PullToRefresh and lazy loading and caching listview images from this http://codehenge.net/blog/2011/06/android-development-tutorial-asynchronous-lazy-loading-and-caching-of-listview-images/.

Everything works well, but I have next problem: when I'm scrolling listview and dowloading more and more items I get the error message about out of memory. How can I solve this problem?

Vlad B
  • 59
  • 5
  • all posts and images are in memory ? – njzk2 Nov 06 '12 at 16:17
  • Trace to where logcat told you OOM. – Trung Nguyen Nov 06 '12 at 16:26
  • that might be due to size of images that you are downloading. you need to reduce the size or follow this http://stackoverflow.com/questions/477572/android-strange-out-of-memory-issue-while-loading-an-image-to-a-bitmap-object and http://stackoverflow.com/questions/477572/android-strange-out-of-memory-issue-while-loading-an-image-to-a-bitmap-object/823966#823966 – Amit Hooda Nov 06 '12 at 16:38
  • you should post some code from you listadapter – toadzky Nov 06 '12 at 16:39

2 Answers2

0

- There are many problems with memory exceptions with images (specially bitmaps) on Android, many of which are discussed on stackoverflow. It would probably be best if you went through the existing questions to see if yours matches one of the existing ones, then if not, write up what makes your situation different.

Some examples:

Out of memory exception due to large bitmap size

Android: out of memory exception in Gallery

Android handling out of memory exception on image processing

etc: https://stackoverflow.com/search?q=android+out+of+memory+exception+bitmap

Community
  • 1
  • 1
Kumar Vivek Mitra
  • 33,294
  • 6
  • 48
  • 75
0

Try to load only visible items images and recycle them as soon as they are invisible.) this way you can recycle infinite images.

lazy load creates a cache folder. you may use it to retrieve recycled images as well.

Ercan
  • 3,705
  • 1
  • 22
  • 37