is from from the UI thread
Reason: There is no notification in the main thread ....
1, where the bug appears listview.class 1487 rows if (Mitemcount = = 0) {resetlist (); Invokeonitemscrolllistener (); Return } else if (Mitemcount! = Madapter.getcount () { throw New IllegalStateException ("The content of the adapter have changed but" + "ListView did Not receive a notification. Make sure the content of " + "Your adapter is not modified from a background thread, Only " + "from the UI thread. [In ListView ("+ getId () +", "+ getclass () & Nbsp; + ") with Adapter (" + mAdapter.getCl() () } 2, MItemCount! = Madapter.getcount ()? Adapterview.class 172 line @ViewDebug .exportedproperty the int mitemcount;//should be the number that was last loaded, the private3, Adapterview.class? ListView extends Abslistviewabslistview extends adapterview<listadapter> 4, the main way to solve the network maffairlist.setvisibility ( View.gone); madapter.notifydatasetchanged (); maffairlist.setvisibility (view.visible);only when proactive notifications are resolved, in most cases without notification5. What is madapter.notifydatasetchanged () doing? Click to enter class Baseadapter public void Notifydatasetchanged () {mdatasetobservable.notifychanged (); } point in class Datasetobservable public void Notifychanged () {synchronized (mobservers) {for (datasetobserve R Observer:mobservers) {observer.onchanged (); }}} point in the abstract class Datasetobserverpublic voidonChanged (){//Do nothing} Adapterview.class class Adapterdatasetobserver extends Datasetobserver {private parcelable minstancestate = null; @Override public voidonChanged (){//Implementation MethodMdatachanged = true;molditemcount = Mitemcount;Mitemcount = Getadapter (). GetCount ();//Key Place... ... 6, theoretical solution the list loaded by the ListView is static, the size will not change as long as the list size () changes, immediately send notification 7, my suggestion as long as the list size () changes, immediately notify the main list of size () Changes and notification updates will have a time difference, scrolling the ListView without changing the master list size will greatly reduce the bug, or minimize the animation
Android the content of the adapter have changed but ListView do not receive a notification