On Apr 29, 8:25 pm, Mark Murphy <[email protected]> wrote:
> > 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.

Maybe I didn't explain myself clearly, but I am not calling
setAdapter() every redraw.  ListView.setAdapter() is called once in
onCreate().  I am just telling the ListAdapter.notifyDataSetChanged(),
and that causes ListAdapter.getView() to be called for every object in
the dataset.


> 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.

No, I'm calling ListAdapter.notifyDataSetChanged() when the background
data thread has an update, which is usually 1-2 times per second as
data streams from a remote server.


 > 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.

Yes, we are using recycled "convertView" rows, as far as I can tell.
That is why ListAdapter passes a convertView, whoever designed it
expected it to be used in the way I'm using it, which is pretty much
the only thing you can do when you are trying to display realtime data
that can not only change per cell, but the list can grow and shrink at
will at any time.


> On Fri, Apr 29, 2011 at 8:20 PM, Eric <[email protected]> wrote:
> > On Apr 29, 3:37 pm, Dianne Hackborn <[email protected]> wrote:
>
> > 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.

I'm not sure where I said I was replacing the Adapter.  If I did, that
was a misstatement.  I'm not.  Just calling notifyDataSetChanged() on
the adapter.


-- 
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