0

My recent app is like a forum, i use listview to show each thread. Each of the item contain in the ListView is combined by some textview, one of them called "contentTextView" is used to show the content of the thread, i also use TextView.fromHtml to show some custom tags and pictures. Sometimes there is a lot of pictures in one thread, for example 100. Although i use Bitmap.imageScale to get a smaller pictures, but maybe the image is so many there always a out-of-memory error.

I have check all the solution on the internet, but i only find some way like WeakReference...i think my problem is because of the TextView always trying to show everything in it at the same time....

So I am wandering if there is a solution to make it load what it should be seen by user?

lwj0012
  • 3
  • 4

1 Answers1

0

You should use the "lazy load" and "recycling" approaches. Take a look at Fedor's code here: Lazy load of images in ListView

Community
  • 1
  • 1
asktomsk
  • 2,289
  • 16
  • 23
  • thanks, but i think i don't make the problem clear. In the case of you link, each row only contain few images or just one, but when some row of the listview contain lots of images, the "lazy load" way seems useless. – lwj0012 Mar 04 '12 at 14:37
  • maybe the problem is that the TextView always load everything, including lots of images, in that case cause the out-of-memory error. What do u think about this? – lwj0012 Mar 04 '12 at 14:39
  • Seems you should remove images before render the thread. And research some way to show and dispose it dynamically on scrolling. – asktomsk Mar 05 '12 at 04:17