`
lrc_1986
  • 浏览: 92893 次
  • 性别: Icon_minigender_1
  • 来自: 沈阳
社区版块
存档分类
最新评论

Bug(The content of the adapter has changed but ListView did not receive a notif)

阅读更多
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(2131231139, class android.widget.ListView) with Adapter(class android.widget.HeaderViewListAdapter)]
	at android.widget.ListView.layoutChildren(ListView.java:1538)
	at android.widget.AbsListView.onTouchModeChanged(AbsListView.java:2977)
	at android.view.ViewTreeObserver.dispatchOnTouchModeChanged(ViewTreeObserver.java:606)
	at android.view.ViewRootImpl.ensureTouchModeLocally(ViewRootImpl.java:2766)
	at android.view.ViewRootImpl.ensureTouchMode(ViewRootImpl.java:2750)
	at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2889)
	at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2471)
	at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:849)
	at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2480)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:137)
	at android.app.ActivityThread.main(ActivityThread.java:4424)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
	at dalvik.system.NativeStart.main(Native Method)

=============================================================================================
1.是否在主线程
2.设置数据之前要隐藏view,设置之后再显示view
3.要clear,后要notifyDateChanged
4.暂停时停止后台操作,恢复后清空adapter,再重新加载


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics