java.lang.IllegalStateException android系统中的ListView [英] java.lang.IllegalStateException in android listview

查看:209
本文介绍了java.lang.IllegalStateException android系统中的ListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的列表视图中的应用程序的工作我在哪里接受 java.lang.IllegalStateException 错误。我不知道我怎么能清除此错误。

I am working in listview application where i am receiving the java.lang.IllegalStateException error. I don't know how could i clear this error.

错误:

4-26 12:45:09.493: E/AndroidRuntime(276): 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(2131361857, class android.widget.ListView) with Adapter(class com.Adapter)]
04-26 12:45:09.493: E/AndroidRuntime(276):  at android.widget.ListView.layoutChildren(ListView.java:1492)
04-26 12:45:09.493: E/AndroidRuntime(276):  at android.widget.AbsListView.onTouchModeChanged(AbsListView.java:1960)
04-26 12:45:09.493: E/AndroidRuntime(276):  at android.view.ViewTreeObserver.dispatchOnTouchModeChanged(ViewTreeObserver.java:591)
04-26 12:45:09.493: E/AndroidRuntime(276):  at android.view.ViewRoot.ensureTouchModeLocally(ViewRoot.java:2021)
04-26 12:45:09.493: E/AndroidRuntime(276):  at android.view.ViewRoot.ensureTouchMode(ViewRoot.java:2005)
04-26 12:45:09.493: E/AndroidRuntime(276):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1774)
04-26 12:45:09.493: E/AndroidRuntime(276):  at android.os.Handler.dispatchMessage(Handler.java:99)
04-26 12:45:09.493: E/AndroidRuntime(276):  at android.os.Looper.loop(Looper.java:123)
04-26 12:45:09.493: E/AndroidRuntime(276):  at android.app.ActivityThread.main(ActivityThread.java:4627)
04-26 12:45:09.493: E/AndroidRuntime(276):  at java.lang.reflect.Method.invokeNative(Native Method)
04-26 12:45:09.493: E/AndroidRuntime(276):  at java.lang.reflect.Method.invoke(Method.java:521)
04-26 12:45:09.493: E/AndroidRuntime(276):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-26 12:45:09.493: E/AndroidRuntime(276):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-26 12:45:09.493: E/AndroidRuntime(276):  at dalvik.system.NativeStart.main(Native Method)

任何人可以帮助我@Thanks

Could anybody help me @Thanks

推荐答案

看来你正在改变UI线程之外ListView的适配器。

It seems you are changing the Listview adapter outside of the UI thread.

检查以下链接:

<一个href=\"http://stackoverflow.com/questions/3132021/android-listview-illegalstateexception-the-content-of-the-adapter-has-changed\">Android, ListView控件IllegalStateException异常:&QUOT;适配器的内容发生了变化,但ListView控件没有收到通知&QUOT;

<一个href=\"http://stackoverflow.com/questions/10241765/list-view-java-lang-illegalstateexception-even-after-calling-notifydatasetcanged\">list鉴于java.lang.IllegalStateException甚至要求后notifyDataSetCanged();

这篇关于java.lang.IllegalStateException android系统中的ListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆