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 the first call, because myNewDataSetSize != myOldDataSetSize(), that was forcing a ArrayAdapter.notifyDataSetChanged() as expected. However, later in the same thread I caused the data to refresh again, this time myNewDataSetSize == myOldDataSetSize, and I tried to iterate over the loop above and grab the data set item using ArrayAdapter.getItem() using a stale position keyed-off of ListView.getFirstVisiblePosition(). Basically the way I fixed it is to just call notifyDataSetChanged() instead of doing a manual update to my ListView cells if I detect ListView.getFirstVisiblePosition() is stale (i.e. myCurrentDataSetSize < ListView.getFirstVisiblePosition(), or ListView.getLastVisiblePosition() > myCurrentDataSetSize).
So I guess my question changes to -- what happens if I call ListView.notifyDataSetChanged() twice (or more) in the same 'event loop' -- will the calls be coalesced together such that the ListView will only redraw one time in the next redraw cycle? -- 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