zoukankan      html  css  js  c++  java
  • The content of the adapter has changed but ListView did not receive a notification

      问题原因:Adapter数据更新后,没有及时使用notifyDataSetChanged()方法通知UI,导致出现数据不一致而报错。

    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(2131690143, class android.widget.ListView) with Adapter(class com.hotalk.ui.homepage.favorites.FavoritesListAdapter)]
    at android.widget.ListView.layoutChildren(ListView.java:1510)
    at android.widget.AbsListView.onLayout(AbsListView.java:1260)
    at android.view.View.layout(View.java:7204)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
    at android.view.View.layout(View.java:7204)
    at com.hotalk.util.slider.ViewFlow.onLayout(ViewFlow.java:222)
    at android.view.View.layout(View.java:7204)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
    at android.view.View.layout(View.java:7204)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
    at android.view.View.layout(View.java:7204)
    at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
    at android.view.View.layout(View.java:7204)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
    at android.view.View.layout(View.java:7204)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7204)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7204)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7204)
    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254)
    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130)
    at android.widget.LinearLayout.onLayout(LinearLayout.java:1047)
    at android.view.View.layout(View.java:7204)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7204)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7204)
    at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
    at android.view.View.layout(View.java:7204)
    at android.view.ViewRoot.performTraversals(ViewRoot.java:1142)
    at android.view.ViewRoot.handleMessage(ViewRoot.java:1861)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:130)
    at android.app.ActivityThread.main(ActivityThread.java:3683)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:653)
    at dalvik.system.NativeStart.main(Native Method)
  • 相关阅读:
    并发之线程封闭与ThreadLocal解析
    并发之不可变对象
    开发者
    并发之atomicInteger与CAS机制
    并发之synchronized关键字的应用
    并发之volatile关键字
    并发研究之可见性、有序性、原子性
    并发研究之Java内存模型(Java Memory Model)
    并发研究之CPU缓存一致性协议(MESI)
    线程安全的日期处理
  • 原文地址:https://www.cnblogs.com/shaweng/p/2571221.html
Copyright © 2011-2022 走看看