Wednesday, October 21, 2009

[android-developers] Re: ListView with Streaming Content

No need to call 'invalidate()' on your list-view.
Call 'notifyDatasetChanged()' on your customer adapter instead,
whenever you add or delete elements in your ArrayList or change the
contents of existing elements in your ArrayList.

On Oct 21, 7:53 am, Marc Lester Tan <mail...@gmail.com> wrote:
> Hi Migs,
>
> You can try creating custom adapter (subclassing BaseAdapter) backed by an
> ArrayList. So lets say a new data comes in, get the currently selected
> index, push your new data to arraylist, call invalidate on your listview
> then call setSelection(position) on listview.
>
> hth,
> Marc
>
>
>
> On Wed, Oct 21, 2009 at 7:34 PM, Miguel Paraz <mpa...@gmail.com> wrote:
>
> > Hi,
> > I'd like to build a ListView with streaming content. New items are
> > added to the top and old ones are forgotten
>
> > If I understand correctly, the ListView was not built for this, right?
> > The ListAdapter was meant to provide a fixed set of data.
>
> > I tried to setAdapter() when new data comes in, but this makes the
> > ListView forget the current selection.
>
> > Is it feasible to subclass or modify ListView behavior so that the
> > selection stays  the same but gets pushed down?
>
> > Thanks!- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate