请告知我的代码问题是什么。???
STACK_TRACE=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(2131296324, class android.widget.ListView) with Adapter(class com.platinumapps.platinumtasks.ActionsAdapter)]
at android.widget.ListView.layoutChildren(ListView.java:1556)
at android.widget.AbsListView$CheckForTap.run(AbsListView.java:2868)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4126)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:0)
在下面调用this,将其置于一个线程
中 runOnUiThread(new Runnable(){
@Override
public void run() {
// call it here
}
}
答案 1 :(得分:0)
使用Handlers
,UI-threads
或AsyncTask
(postexecute)致电notifydatasetchanged();
。
你是在后台线程中做的......