The content of the adapter has changed解决方法

来源:互联网 发布:ad hoc网络协议 编辑:程序博客网 时间:2024/05/06 15:20

很多新手在Android开发时可能对Thread和Message以及Handler、Looper概念不是很清楚,可能产生类似 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.的错误。来自邮箱中这个问题,解决方法必须要详细的代码,不过给出以下几点可以帮助你了解该问题:

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

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

原创粉丝点击