adapter刷新时需要在主线程之中记录

adapter刷新时需要在主线程之中记录

结论:adapter的notifychange需要在主线程之中,可以使用runonuithread方法切换线程

mpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:6600)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:931)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:361)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:361)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.view.View.requestLayout(View.java:18745)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.widget.AbsListView.requestLayout(AbsListView.java:1975)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.widget.AdapterView$AdapterDataSetObserver.onChanged(AdapterView.java:840)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.widget.AbsListView$AdapterDataSetObserver.onChanged(AbsListView.java:6256)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.database.DataSetObservable.notifyChanged(DataSetObservable.java:37)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at android.widget.BaseAdapter.notifyDataSetChanged(BaseAdapter.java:50)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at com.kidswant.component.base.adapter.KWBaseAdapter.setData(KWBaseAdapter.java:70)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at com.kidswant.kidim.ui.ChatSessionFragment.resetAdapter(ChatSessionFragment.java:483)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at com.kidswant.kidim.ui.ChatSessionFragment.onUserInfoCallback(ChatSessionFragment.java:889)
01-08 20:29:18.785 27036 27225 E AndroidRuntime:     at com.kidswant.kidim.chat.UserInfoLoader.notifyObservers(UserInfoLoader.java:62)