For Google about BaseAdapter class

In Android 1.6 and 2.0 the BaseAdapter class has apparently been
modified to throw an exception when it sees the Adapter.getCount()
method return a number different than what it picked up when
BaseAdapter.notifyDataSetChanged() was called (at least I did not
observe this behavior in pre 1.6).

So now the question is, when should one call notifyDataSetChanged() or
more importantly, when can the count in the Adapter be safely changed?

Consider the case of an app with a background thread delivering data
to a BaseAdapter at a rate faster than the ListView responds to
notifyDataSetChanged(). Because notifyDataSetChanged() is a
synchronous call and the ListView updates are taking place sometime in
the indeterminate future on the UI thread, how can an app know when it
is safe to change the adapter count?

If the app changes the count while the ListView is updating itself the
exception will be thrown (and there is no way to catch the exception).

Is there a way to know when it is safe to change the count in the
BaseAdapter?

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