Android-bug:the content of the adapter have changed but ListView do not receive a notification.

Source: Internet
Author: User

bug:the content of the adapter have changed but ListView do not receive a notification.


This address: Http://blog.csdn.net/caroline_wendy


error log:
Java.lang.IllegalStateException:The content of the adapter have changed but ListView do not receive a notification. Make sure the content of your adapter are not modified from a background thread, but only from the UI thread. Make sure your adapter calls notifydatasetchanged () while its content changes. [In the ListView (2131494123, Class Me.chunyu.ChunyuDoctor.Widget.RefreshableListView) with Adapter (class Android.widget.HeaderViewListAdapter)] at Android.widget.ListView.layoutChildren (listview.java:1566) at Android.wi Dget. Abslistview.ontouchmodechanged (abslistview.java:3580) at Android.view.ViewTreeObserver.dispatchOnTouchModeChanged (viewtreeobserver.java:879) at Android.view.ViewRootImpl.ensureTouchModeLocally (viewrootimpl.java:3543) at android.view.viewrootimpl.access$400 (viewrootimpl.java:111) at Android.view.viewrootimpl$viewroothandler.handlemessage (ViewRootImpl.java:3274) at Android Oid.os.Handler.dispatchMessage (handler.java:102) at Android.os.Looper.loop(looper.java:135) at Android.app.ActivityThread.main (activitythread.java:5505) at Java.lang.reflect.Method.invoke ( Native Method) at Java.lang.reflect.Method.invoke (method.java:372) at Com.android.internal.os.zygoteinit$methodand Argscaller.run (zygoteinit.java:948) at Com.android.internal.os.ZygoteInit.main (zygoteinit.java:743)

Solution:Replacement: refreshablelistfragment-remotedatalist2fragmentinclude:doclistbyexpertiseactivity, Addregdochomeactivity, familydocmsglistactivity,thankdoctoractivity, Addreglistactivity, familydochomeactivity, FragmentWraperActivity2;
Location:when the refresh bar is stopped, the data for the ListView is updated to synchronize.
                    @Override public                    void onscrollstatechanged (Abslistview abslistview, int i) {                        mscrollstatus = i;                        if (Mscrollstatus = = AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {                            getlistview (). Setonscrolllistener ( Getdefaultscrolllistener ());                            Mhandler.post (New Runnable () {                                @Override public                                void Run () {                                    Refreshlistview (Mloadingmore, (list<? >) data.getdata ());                                }                            );}                        }                    


can be.


Android-bug:the content of the adapter have changed but ListView do not receive a notification.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.