Have you considered using placeholder images instead? Replace the
placeholder images with the real ones as they come in. Then, when the
background thread finishes, you do not have to do anything -- the images
are already loaded. This eliminates the need to "refresh the listview"
and any accompanying confusing such a refresh might cause the user.
--
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html
Don't refresh it with setListAdapter! Just modify the content of the adapter instead.
On Mar 23, 2009 7:03 PM, "Ivan Soto" <ivan...@gmail.com> wrote:But when I refresh the listview with setlistadapter(listadapter) it returns to the top.Mark:Do you have any article/tutorial about the placeholder images to share? I'm trying to find one with no luck.Thanks for helping.Ivan Soto Fernandez Web Developer http://ivansotof.com
On Mon, Mar 23, 2009 at 7:38 PM, Romain Guy <roma...@google.com> wrote:
> > > ListView does not use scrollY. There's no need to save the scroll > anyway because ListView do...
--> Romain Guy > Android framework engineer > roma...@android.com > > Note: please don't send priva...
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are sub...
I have used the technique, but not in code I'm allowed to share. I do
need to more formally write this up at some point, but I do not have
anything immediately handy.
The gist of it is that you create your adapter and set it up, in
getView() or newView()/bindView() (depending on adapter choice), to see
if the thumbnail has been downloaded. If so, use it for the list row
being inflated/updated; if not, leave the ImageView in the row pointing
to some placeholder Drawable resource. This means as the user scrolls,
she will pick up the thumbnails. Also, at the end, you can quickly
iterate over the rows (ListView is a ViewGroup, IIRC, so there are
methods to iterate its children) and ensure each of those rows'
ImageViews are using their associated thumbnails.