On Apr 30, 11:05 pm, Streets Of Boston <[email protected]> wrote: > Yes, you're right about that. Calling notifyDataSetChanged on the adapter is > the best way to go and you should use it in 99% of cases. However, in some > cases rules should be broken. :) > A call to notifyDataSetChanged redraws all the children in the ListView and > is relatively expensive and you get the side effects you notice in your > example (touch issues). > In this case, another solution may be necessary, where visible list-items > (child-views of the ListView) or their children update *themselves*. > You could do this by tagging list-item views (contentView-s) by calling > setTag an do a getTag on all the ListView's child-views to be able to find > them back when they need updating.
I continue to disagree with this. First of all, the ListView should only be redrawing what is visible on the screen. That is why the Adaptor has a getView(int position...) method, so that the ListView can be smart about which views it needs to redraw. Second of all, the children VIEWS should not be responsible for updating themselves when the underlying data changes. This is precisely why the ListView's Adaptor has a notifyDatasetChanged! So that you can give a hint do the ListView that the data has changed, and so that it can ask for the Views it needs to update. the getView() method on Adaptor also has a "View convertView" arg so that it can pass the getView() method a recycled view to update. At the very worst, Adaptor needs to be updated to have a "notifyDatasetChangedAtIndex(int[] indexes)" method so that the ListView can be even smarter about which row(s) to redisplay (instead of redisplaying the visible rows as it currently does). In any case, I just don't see why my VIEW code should be smart about updating itself when the underlying data changes; in other words isn't that what the Adaptor is supposed to do for me? -- 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

