java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling

tip
Do you find the tips below useful? Click on the to mark them and say thanks to Rafael Fischer Viola . Or join the community to write better ones.
  1. 0

    RecyclerView creats app crash on scrolling horizontly

    Stack Overflow | 10 months ago | Nitish Srivastava
    java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
  2. 0
    samebug tip
    Try to reset the previous listener before making any changes to the view.
  3. 0
    samebug tip
    This probably occurs because you are calling notifyItemInserted(position);, notifyItemChanged(position), or notifyItemRemoved(position); from a background thread (or from a callback, which runs on a background thread). Use a Handler to solve it.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    How to select and unselect the recycleview in android

    Stack Overflow | 10 months ago | Abserve Tech
    java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
  6. 0

    Android RecyclerView : notifyDataSetChanged() IllegalStateException

    Stack Overflow | 3 years ago | Arthur
    java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    Cannot call this method while RecyclerView is computing a layout or scrolling

    at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll()
  2. Android v7
    RecyclerView$Adapter.notifyDataSetChanged
    1. android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:2161)
    2. android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onChanged(RecyclerView.java:4249)
    3. android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyChanged(RecyclerView.java:9924)
    4. android.support.v7.widget.RecyclerView$Adapter.notifyDataSetChanged(RecyclerView.java:5741)
    4 frames
  3. com.virginredapp.ui
    TreasureHuntDashboardFragment$2.onScrolled
    1. com.virginredapp.ui.custom.ParallaxRecyclerAdapter.addData(ParallaxRecyclerAdapter.java:201)
    2. com.virginredapp.ui.adapter.TreasureHuntFeedAdapter.addData(TreasureHuntFeedAdapter.java:94)
    3. com.virginredapp.ui.fragments.TreasureHuntDashboardFragment.hideLoadmoreView(TreasureHuntDashboardFragment.java:257)
    4. com.virginredapp.ui.fragments.TreasureHuntDashboardFragment.access$700(TreasureHuntDashboardFragment.java:86)
    5. com.virginredapp.ui.fragments.TreasureHuntDashboardFragment$2.onScrolled(TreasureHuntDashboardFragment.java:283)
    5 frames
  4. Android v7
    RecyclerView.onLayout
    1. android.support.v7.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:3948)
    2. android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3102)
    3. android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2914)
    4. android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3277)
    4 frames
  5. Android Platform
    ActivityThread.main
    1. android.view.View.layout(View.java:15047)
    2. android.view.ViewGroup.layout(ViewGroup.java:4676)
    3. android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    4. android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    5. android.view.View.layout(View.java:15047)
    6. android.view.ViewGroup.layout(ViewGroup.java:4676)
    7. android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    8. android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    9. android.view.View.layout(View.java:15047)
    10. android.view.ViewGroup.layout(ViewGroup.java:4676)
    11. android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
    12. android.view.View.layout(View.java:15047)
    13. android.view.ViewGroup.layout(ViewGroup.java:4676)
    14. android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    15. android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    16. android.view.View.layout(View.java:15047)
    17. android.view.ViewGroup.layout(ViewGroup.java:4676)
    18. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
    19. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
    20. android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
    21. android.view.View.layout(View.java:15047)
    22. android.view.ViewGroup.layout(ViewGroup.java:4676)
    23. android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    24. android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    25. android.view.View.layout(View.java:15047)
    26. android.view.ViewGroup.layout(ViewGroup.java:4676)
    27. android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
    28. android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
    29. android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
    30. android.view.View.layout(View.java:15047)
    31. android.view.ViewGroup.layout(ViewGroup.java:4676)
    32. android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
    33. android.widget.FrameLayout.onLayout(FrameLayout.java:388)
    34. android.view.View.layout(View.java:15047)
    35. android.view.ViewGroup.layout(ViewGroup.java:4676)
    36. android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2189)
    37. android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1896)
    38. android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1103)
    39. android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6018)
    40. android.view.Choreographer$CallbackRecord.run(Choreographer.java:799)
    41. android.view.Choreographer.doCallbacks(Choreographer.java:599)
    42. android.view.Choreographer.doFrame(Choreographer.java:559)
    43. android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:784)
    44. android.os.Handler.handleCallback(Handler.java:733)
    45. android.os.Handler.dispatchMessage(Handler.java:95)
    46. android.os.Looper.loop(Looper.java:157)
    47. android.app.ActivityThread.main(ActivityThread.java:5872)
    47 frames
  6. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invokeNative(Native Method)
    2. java.lang.reflect.Method.invoke(Method.java:515)
    2 frames
  7. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
    2 frames
  8. Android Platform
    NativeStart.main
    1. dalvik.system.NativeStart.main(Native Method)
    1 frame