最近在做蓝牙列表刷新选取的功能,其中在做点击压力测试的时候出现了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. Make sure your adapter calls notifyDataSetChanged() when its content changes.的错误。
错误提示中明确指出了因为listview的adapter发生了变化,而listview并没有更新引起的问题。于是我开始逐步的分析查找,因为我代码中在更新数据的时候调用了notifyDataSetChanged方法,且是在UI线程中执行的。没有使用子线程去更新adapter,这一点还是可以确定的(可以debug断点调试)。