0

我得到了一个已ItemTouchHelper实现的 RecyclerView。当刷一个项目并同时更改当前片段时,应用程序崩溃(是的,我得到了一个关于它的崩溃分析并且可以重现它)。

以下崩溃异常来自ItemTouchHelper类。崩溃发生在这个方法postDispatchSwipe上,RecyclerView 为空。由于该方法是在滑动手势之后调用的,我想知道我是否可以从我身边做一些事情或填写谷歌问题。

如果你们有任何想法...谢谢:)

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean androidx.recyclerview.widget.RecyclerView.post(java.lang.Runnable)' on a null object reference
        at androidx.recyclerview.widget.ItemTouchHelper.postDispatchSwipe(ItemTouchHelper.java:700)
        at androidx.recyclerview.widget.ItemTouchHelper$3.onAnimationEnd(ItemTouchHelper.java:653)
        at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:552)
        at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1232)
        at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1474)
        at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:146)
        at android.animation.AnimationHandler.access$100(AnimationHandler.java:37)
        at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:54)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1063)
        at android.view.Choreographer.doCallbacks(Choreographer.java:877)
        at android.view.Choreographer.doFrame(Choreographer.java:805)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1051)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:201)
        at android.app.ActivityThread.main(ActivityThread.java:6806)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
4

0 回答 0