Android的java.lang.IllegalStateException

解决ListView通知异常
本文介绍了解决Android中ListView出现The content of the adapter has changed but ListView did not receive a notification错误的方法。通过确保适配器更新仅在UI线程中进行,并在适配器内容更改后调用notifyDataSetChanged()来解决问题。

报错异常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(2131034125, class cn.edu.pdsu.refresh.view.XListView) with Adapter(class android.widget.HeaderViewListAdapter)]

进行翻译:适配器的内容已经改变但列表视图没有收到通知。确保你的适配器不修改的内容从一个后台线程,但只有从UI线程。(在列表视图(2131034125,类cn.edu.pdsu.refresh.view.XListView)与适配器(类android.widget.HeaderViewListAdapter))

经过翻译很是清晰,就是说:适配器的内容已经改变但列表视图没有收到通知,

经过分析,就是在适配器的内容发生改变时进行                mAdapter.notifyDataSetChanged();操作

大笑ok问题解决。

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值