PullToRefreshListView $ InternalListViewSDK9中的IllegalStateException

时间:2013-09-29 11:39:28

标签: java android illegalstateexception pull-to-refresh

我在我的应用程序的两个活动中使用PullToRefresh库。我知道,这个库已被弃用,但它非常有用,它不仅可以从顶部而且可以从底部处理刷新的基础。但它有一个问题:很少应用程序崩溃与此日志:

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(16908298, class com.handmark.pulltorefresh.library.PullToRefreshListView$InternalListViewSDK9) with Adapter(class android.widget.HeaderViewListAdapter)]
 at android.widget.ListView.layoutChildren(ListView.java:1551)
 at android.widget.AbsListView.onTouchEvent(AbsListView.java:4218)
 at android.view.View.dispatchTouchEvent(View.java:7461)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2264)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1995)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2270)
 at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2010)
 at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2182)
 at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1512)
 at android.app.Activity.dispatchTouchEvent(Activity.java:2466)
 at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2130)
 at android.view.View.dispatchPointerEvent(View.java:7641)
 at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3682)
 at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3613)
 at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4804)
 at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4783)
 at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4875)
 at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
 at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
 at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:174)
 at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4854)
 at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4894)
 at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
 at android.view.Choreographer.doCallbacks(Choreographer.java:562)
 at android.view.Choreographer.doFrame(Choreographer.java:530)
 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
 at android.os.Handler.handleCallback(Handler.java:725)
 at android.os.Handler.dispatchMessage(Handler.java:92)
 at android.os.Looper.loop(Looper.java:137)
 at android.app.ActivityThread.main(ActivityThread.java:5328)
 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:1102)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
 at dalvik.system.NativeStart.main(Native Method)

这种崩溃很少发生,我只能在经常使用的几个月内在我的设备上看到它。但我会在Google Play开发者控制台中看到来自用户的此日志的崩溃报告。

据我了解,此崩溃不在我的代码中发生,这发生在InternalListViewSDK9类的PullToRefresh库的代码中。这是InternalListViewSDK9的代码:

@TargetApi(9)
final class InternalListViewSDK9 extends InternalListView {

    public InternalListViewSDK9(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX,
            int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent) {

        final boolean returnValue = super.overScrollBy(deltaX, deltaY, scrollX, scrollY, scrollRangeX,
                scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);

        // Does all of the hard work...
        OverscrollHelper.overScrollBy(PullToRefreshListView.this, deltaY, scrollY, isTouchEvent);

        return returnValue;
    }
}

如何修复此错误,考虑到我无法重现它?可能有可能压制它吗?

0 个答案:

没有答案