Saturday, December 3, 2011

[android-developers] Re: Is it possible to add rows to the listview from the top?

No, don't do this. Just change the data backing your adapter (in the
main thread) and call its notifyDatasetChanged() method. That will
tell the adapter to update the ListView to which it's attached. Or
you could create a new adapter and set it on the ListView.

Doug

On Dec 1, 1:26 am, "B.Arunkumar" <awsnetworkrecor...@gmail.com> wrote:
> Hi,
>
>   Actually I have been able to solve the requirement by using the
> listview onHierarchychangedListner. You iwll have to manually change
> the background of the rows in the onHierarchychangedListner after the
> row is added to the listview.
>
> Thank you,
> B.Arunkumar
>
> On Nov 30, 2:02 pm, skink <psk...@gmail.com> wrote:
>
>
>
>
>
>
>
> > B.Arunkumarwrote:
> > > Hi,
>
> > >    I have a question regarding listview. This is the requirement:
>
> > > 1. When a first element is added to the listview, the background of
> > > the row should be black. After 1 minute, the background of the row
> > > should become blue (which I do it a separate thread).
>
> > > 2. A second row should be added to the listview at the top of row1 and
> > > it should be black. After 1 minute, it should turn blue in a similar
> > > way.
>
> > > Now, whatever I do, the 2nd element is getting added to the bottom of
> > > the listview and the 1st row remains blue and the 2nd row remains
> > > black. How can I add rows to the top of the listview with this
> > > requirement?
>
> > > Thank you,
> > >B.Arunkumar
>
> > what Adapter are you using?
>
> > pskink

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

No comments:

Post a Comment