Listview displays images only after scroll
I'm new to android programming, and i'm writing a piece of code based on Fedor's LazyList example. The idea is to load images and text from a feed, so that works fine but a little prob occured : Images are downloaded and cached on SD Card, queued and displayed the problem is that the listview displayes the default images (on drawable folder) until i scroll it up 开发者_运维技巧or down there it shows the real images.
Please help.
Here's a link to code link text
thanks
Please look at my sample code carefully. You should add imageView.setTag()
before imageLoader.DisplayImage()
in MessageListAdapter
.
This is because when you scroll getview function in the adapter is called and images are loaded in that function. You need to use some good / faster code to load images. I would suggest you to try below link.
http://umakantpatil.com/posts/android-listview-with-separate-headers-and-images-loading-from-remote-server
It has headers in the list, you can just use the code of loading images from that example.
change
getActivity().getApplicationContext() = getActivity().getBaseContext()
精彩评论