> We can't really do that.  Many of the screens in the app show market
> depth, and the depth changes update-by-update.  You need to redraw the
> entire list every time.

ListView is not designed to support setAdapter() being called with
that frequency. If that is how you "redraw the entire list every
time", I would not expect good results. You may even wind up
allocating memory faster than the garbage collector can free it,
causing you to eventually run out of heap space.

If, however, when the data updates come in, you are walking the
current child Views of the ListView (i.e., the visible rows) and
tweaking their contents, that should be OK. When the user scrolls,
you'll be binding the then-latest data to the recycled rows as they
roll onto the screen, then updating from there afterwards. You may
still run into problems with flings being slow, but I don't know how
long your list is.

On Fri, Apr 29, 2011 at 8:20 PM, Eric <[email protected]> wrote:
> On Apr 29, 3:37 pm, Dianne Hackborn <[email protected]> wrote:
>> but you don't want to tell the list view that your data set has changed 
>> because
>> then it needs to throw all of its current views away, retrieve the new data,
>> and bind that data to new views.
>
> I thought the views get recycled?  Isn't that what the convertView
> argument is in the ListAdapter?

If you are replacing the adapter, the old views get flushed
completely. They have to be. There is no assumption that the views
from Adapter instance #1 are remotely relevant for Adapter instance
#2.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to