zoukankan      html  css  js  c++  java
  • 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()方法,当然主要看你代码的具体情况。

  • 相关阅读:
    DeflateStream类
    BufferedStream类
    FileStream类
    Asp.net MVC Comet 推送
    MVC 读书笔记
    MVC部署
    MVC系统过滤器、自定义过滤器
    MVC 路由规则
    MVC 模型绑定
    边双+点双模板
  • 原文地址:https://www.cnblogs.com/royi123/p/3228224.html
Copyright © 2011-2022 走看看