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

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

,
Expert 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.

,
via stackoverflow.com by Unknown author

You can find the exact answer on the link.

Solutions on the web

via Stack Overflow by Nitish Srivastava
, 1 year ago
Cannot call this method while RecyclerView is computing a layout or scrolling
via github.com by Unknown author, 1 year ago
via GitHub by door43app
, 2 years ago
Cannot call this method while RecyclerView is computing a layout or scrolling
via GitHub by door43app
, 2 years ago
Cannot call this method while RecyclerView is computing a layout or scrolling
via Stack Overflow by Muharrem
, 6 months ago
Cannot call this method while RecyclerView is computing a layout or scrolling
via GitHub by jshernandez15
, 1 month ago
Cannot call this method while RecyclerView is computing a layout or scrolling
java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling
at android.support.v7.widget.RecyclerView.assertNotInLayoutOrScroll(RecyclerView.java:2161)
at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onChanged(RecyclerView.java:4249)
at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyChanged(RecyclerView.java:9924)
at com.virginredapp.ui.custom.ParallaxRecyclerAdapter.addData(ParallaxRecyclerAdapter.java:201)
at com.virginredapp.ui.adapter.TreasureHuntFeedAdapter.addData(TreasureHuntFeedAdapter.java:94)
at com.virginredapp.ui.fragments.TreasureHuntDashboardFragment.hideLoadmoreView(TreasureHuntDashboardFragment.java:257)
at com.virginredapp.ui.fragments.TreasureHuntDashboardFragment.access$700(TreasureHuntDashboardFragment.java:86)
at com.virginredapp.ui.fragments.TreasureHuntDashboardFragment$2.onScrolled(TreasureHuntDashboardFragment.java:283)
at android.support.v7.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:3948)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3102)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2914)
at android.view.View.layout(View.java:15047)
at android.view.ViewGroup.layout(ViewGroup.java:4676)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15047)
at android.view.ViewGroup.layout(ViewGroup.java:4676)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15047)
at android.view.ViewGroup.layout(ViewGroup.java:4676)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1055)
at android.view.View.layout(View.java:15047)
at android.view.ViewGroup.layout(ViewGroup.java:4676)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15047)
at android.view.ViewGroup.layout(ViewGroup.java:4676)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:15047)
at android.view.ViewGroup.layout(ViewGroup.java:4676)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15047)
at android.view.ViewGroup.layout(ViewGroup.java:4676)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1434)
at android.view.View.layout(View.java:15047)
at android.view.ViewGroup.layout(ViewGroup.java:4676)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
at android.view.View.layout(View.java:15047)
at android.view.ViewGroup.layout(ViewGroup.java:4676)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2189)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1896)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1103)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6018)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:799)
at android.view.Choreographer.doCallbacks(Choreographer.java:599)
at android.view.Choreographer.doFrame(Choreographer.java:559)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:784)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5872)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)

Users with the same issue

2 times, 8 months ago
Once, 8 months ago
137 times, 11 months ago
7 times, 1 year ago
30 times, 1 year ago

Write tip

Know the solutions? Share your knowledge to help other developers to debug faster.