On Thu, Jul 7, 2011 at 4:48 AM, Amir Tsafrir <atsaf...@gmail.com> wrote:
> I have a problem with ListView which recycles views that are visible on the
> screen.
> I can have up to 4 items in my the ListView, they are all visible on
> screen.
> After I update a property of an object in the ArrayList that the ListAdapter
> uses i call the notifyDataSetChanged() method of the list adapter.
> This causes the ListView to recycle the views and to redraw it self. The
> problem is that it's doing the recycling in a reverse order.

The order of recycling is not guaranteed.

> so if i have a button on the first Listview item it will be in the second
> list view item after the notifyDataSetChanged().

This is perfectly normal.

> I have getView that changes the convertView properties except for the button
> onTouchListenet.
> This is very problematic if i have a button that works with touch event
> (Like PTT button). one second it's there and than it's not :-(.
> 1. why does the ListView recycle items that are visible on the screen ? is
> this normal behaviour? why does it done in reverse order ?
> 2. What can I do to solve my issue ?

Write an implementation of getView() that makes no assumptions about
the order of the getView() calls. Or, do not use ListView.

-- 
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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to