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 Esby
, 1 year ago
Cannot call this method while RecyclerView is computing a layout or scrolling
via Stack Overflow by Muharrem
, 4 months ago
Cannot call this method while RecyclerView is computing a layout or scrolling
via Stack Overflow by Gunaseelan
, 10 months ago
Cannot call this method while RecyclerView is computing a layout or scrolling
via Stack Overflow by Arthur
, 1 year ago
Cannot call this method while RecyclerView is computing a layout or scrolling
via Stack Overflow by Abserve Tech
, 1 year 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:2116)
at android.support.v7.widget.RecyclerView$RecyclerViewDataObserver.onChanged(RecyclerView.java:4001)
at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyChanged(RecyclerView.java:9242)
at android.support.design.internal.NavigationMenuPresenter$NavigationMenuAdapter.update(NavigationMenuPresenter.java:427)
at android.support.design.internal.NavigationMenuPresenter.updateMenuView(NavigationMenuPresenter.java:113)
at android.support.v7.view.menu.MenuBuilder.dispatchPresenterUpdate(MenuBuilder.java:284)
at android.support.v7.view.menu.MenuBuilder.onItemsChanged(MenuBuilder.java:1030)
at android.support.v7.view.menu.MenuBuilder.onItemActionRequestChanged(MenuBuilder.java:1076)
at android.support.v7.view.menu.MenuItemImpl.setActionView(MenuItemImpl.java:612)
at android.support.v7.view.menu.MenuItemImpl.setActionView(MenuItemImpl.java:620)
at android.support.v7.view.menu.MenuItemImpl.setActionView(MenuItemImpl.java:40)
at com.mycompany.myapp2.MainActivity$0$debug.updateText(MainActivity.java:323)
at com.mycompany.myapp2.MainActivity.updateText(MainActivity.java)
at com.mycompany.myapp2.MainActivity.access$1000018(MainActivity.java)

Users with the same issue

2 times, 11 months ago
13 times, 1 year ago
2 times, 6 months ago
Once, 6 months ago
7 times, 11 months ago
3 more bugmates

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