[android-developers] Re: getFirstVisiblePosition() not returning the correct value

2011-05-05 Thread Eric
It seems to me I need to assume getFirstVisiblePosition() can get out of sync with the data set, and in order to update my data manually (without calling ArrayAdapter.notifyDataSetChanged) is that I need to iterate over the data set items, not the indexes defined by getFirstVisiblePosition() and

[android-developers] Re: getFirstVisiblePosition() not returning the correct value

2011-05-05 Thread Eric
I figured it out. The long/short of it is that notifyDataSetChanged() does NOT cause ListView.getFirstVisiblePosition() to get updated immediately -- it gets updated on NEXT redraw of the ListView. I had some code that was causing my display method to be called twice in the same event loop. In

[android-developers] Re: getFirstVisiblePosition() not returning the correct value

2011-05-05 Thread Streets Of Boston
Good find! About the multiple calls to notifyDataSetChanged() in the same 'event loop' cycle: I don't think it will cause multiple redraws, much like multiple calls to a view's 'invalidate()' method in the same event-loop cycle that won't cause multiple redraws either. -- You received this