【Android策略决】The content of the adapter has changed but ListView did not receive a notification

友盟错误详情:

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. Make sure your adapter calls notifyDataSetChanged() when its content changes. [in ListView(2131427746, class android.widget.ListView) with Adapter(class com.storm.durian.a.be)]
	at android.widget.ListView.layoutChildren(ListView.java:1555)
	at android.widget.AbsListView$CheckForTap.run(AbsListView.java:3127)
	at android.os.Handler.handleCallback(Handler.java:733)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:136)
	at android.app.ActivityThread.main(ActivityThread.java:5111)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
	at dalvik.system.NativeStart.main(Native Method)

 
 

notifyDataSetChanged()尽量在UI线程中操作,如果一定要在子线程中使用,请参考下面代码!

	context.runOnUiThread(new Runnable() {
			public void run() {
			notifyDataSetChanged();
					}
				});



你可能感兴趣的:(【Android策略决】The content of the adapter has changed but ListView did not receive a notification)