listview在适配数据时,滚动listview的时候会报错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(2131230914, class android.widget.ListView) with Adapter(class android.widget.HeaderViewListAdapter)]
经研究是adapter在handler里面多次创建对象导致,解决方法:
1、在handler里面判断adapter,如果为null,创建一次,之后就不再创建
2、在oncreate里面创建adapter,并适配给listview,数据为0,在handler里面只是notifyDataSetChanged()