Hi, I have a big problem with bitmaps and the listview's behaviour of calling getView() on each position multiple times.
My list contains only bitmaps and fetches them asynchronously from a remote location. Now, when the listview is displayed, since getView() is called about 4 times for each position, it will instantiate 4 different bitmap instances for the same position (and use only one...), and this causes out of memory error. I already tried out some strategies to solve this, like implementing a list of "waiting" imageViews, and fetch only for one, and then set the bitmap for all the waiting ones, but this generated new problems and it's also difficult to synchronize. I tried also adding a list-field with already fetched positions of the listview, in order to fetch and set only once, but it seems to generate a different image view each time (I'm recycling convertView, but anyways), since I end with empty positions (although all the bitmaps where fetched, instantiated and set in one of the imageviews). To solve this I used a map-field which maps position to List<ImageView>, and set the bitmap to all the imageViews which where called for one position. Should work, but it also doesn't. In most positions I get the correct bitmaps, but, for example, in the first position of the list, I get the bitmap from the last visible position (I can see it switches fast, first it shows bitmap from position 0, then 1, then 2, and then 3 -my last visible position-). Any solution? Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en