Android列表视图中的IllegalStateException

时间:2014-07-22 11:45:35

标签: android listview android-asynctask illegalstateexception

我在列表视图

中使用https://github.com/johannilsson/android-pulltorefresh来刷新

这是代码.......... 在AsyncTask onPostExecute我写了这个

adapter=new ServicesTypeTranDetailAdapter(getActivity(), items_list_trandetails);
servicesList.onRefreshComplete();
servicesList.setAdapter(adapter);

我正在做同样的功能我没有得到任何错误。如果我让设备闲置两个小时,那我就收到了这个错误。请帮我。提前谢谢......

致命的例外:主要

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(2131165659, class com.isp.activities.PullToRefreshListView) with Adapter(class android.widget.HeaderViewListAdapter)]
    at android.widget.ListView.layoutChildren(ListView.java:1538)
    at android.widget.AbsListView.onTouchModeChanged(AbsListView.java:2977)
    at android.view.ViewTreeObserver.dispatchOnTouchModeChanged(ViewTreeObserver.java:606)
    at android.view.ViewRootImpl.ensureTouchModeLocally(ViewRootImpl.java:2761)
    at android.view.ViewRootImpl.ensureTouchMode(ViewRootImpl.java:2745)
    at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:2872)
    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2466)
    at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:845)
    at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2475)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4424)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)

0 个答案:

没有答案