• Android Exception 6 (adapter is not modified from a background thread)


    07-23 09:47:34.962: E/AndroidRuntime(7001): java.lang.IllegalStateException: The content of the adapter has changed but ListView did not receive a notification. Make sure the content of your adapter is not modified from a background thread, but only from the UI thread. [in ListView(2131230794, class com.tongyan.widget.view.PullToRefreshListView) with Adapter(class android.widget.HeaderViewListAdapter)]

    这个问题出现的场景是,在同一个Activity中,既使用了Thread,并且使用了AsyncTask

    网上找来的:

    1.改变适配器Adapter内容时不要在后台线程中,必须在UI线程中处理,这点可以通过Handler传出来解决。

    2.尝试Adapter的notifyDataSetChanged()方法,当然主要看你代码的具体情况。

  • 相关阅读:
    ios资源
    学习swift开源项目
    学习di'z地址
    IOS基础库
    IT自学论坛
    HVTableView 分享组
    IOS中的动画菜单
    iOS 通讯录操作
    ios中autolayout
    ios 程序学习
  • 原文地址:https://www.cnblogs.com/royi123/p/3228224.html
Copyright © 2020-2023  润新知