Hi,
I'm experiencing some strange behaviors when using ListActivity that
it's listview is bound to a custom BaseAdapter.
The list I'm using is getting a lot of updates as the items it
contains reflect real time data that is updating up to few times per
second.
The BaseAdapter is written with the viewHolder pattern.
The list also has onClick listener. when clicking on one of the items,
it's id is saved and a new activity is opened with the saved ID
details.

The problem occurs when a call is made to notifyDatasetChanged. as i
mentioned this kind of call could happen few times a second, for
reflecting the real-time data.
When notifyDatasetChanged is called, there is a moment that if I click
an item on the list, the onClick event executed could be on a wrong
item. After some check I've understood that the wrong item is always
the "mirror item" in the list. As if for a moment there, the list
items position is reverted.
e.g I have a list with 3 items. notifyDatasetChanges is being called.
sometimes, click on the first item could get me to the click listener
of the third item, and vice versa! click of the second item is always
getting the right result. if I have a list of 5 items, items 1-5
sometimes get confused, same for items 2-4, and item 3 is always fine.
the confused item are never showed on the view, but the fired click
events shows something's happening on the background.

I had this problem also on different list that working in the same
way, but also contains a button on each list item.
When using the button I can actually see the focus jump around between
the the buttons, when clicking on a button while notifyDatasetChanged
is running. in the example from before: with 3 items, clicking on the
button of the first row, i can sometimes see the button of the last
row being clicked!

This is really bad because it causes opening of activities with the
wrong data...
I've tried making less calls to notifyDatasetChanged, something like
once a second, the problem is happening less, but it's still there, i
guess that even if it would called once every 5 seconds there is a
small chance the wrong item will get the click event...

Is this a known issue? is there something I do that sounds off?
I could upload some code, just wanted to check if it's something
someone known first...

appreciate any thought...

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