10-26 18:30:45.085: E/AndroidRuntime(7323): 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(2131296280, class android.widget.ListView) with Adapter(class com.souapp.appmanager.ApkListAdapter)]
有时候触摸更新数据时候,触摸listview也会报错
网上所有的解决办法:
一、
listView.setVisibility(View.GONE); listView.requestLayout(); listView.setAdapter(mMoveAdapter); listView.setVisibility(View.VISIBLE);
二、不要把从子线程获得的数据直接赋值给 你正在用的list列表,
1.先建立一个临时的数据list 2.把新获得的数据放入到临时list里面 3.然后把临时list传递到主线程 4.把临时list数据添加到 adapter正在用的list里面
三、
下载完数据后,向主线程中的handler发送消息,通过handler来更新adapter中的数据,别忘了notifyDataSetChanged().