java.lang.IllegalStateException

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

Samebug tips1

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.


rafaelrafael

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web36

Stack trace

  • 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.v7.widget.RecyclerView$Adapter.notifyDataSetChanged(RecyclerView.java:5493) 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)

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

filpgamefilpgame
2 times, last one
Diogo JaymDiogo Jaym
13 times, last one
Hiren AmaliyarHiren Amaliyar
2 times, last one
Indri YunitaIndri Yunita
Once,
Aria PahlavanAria Pahlavan
7 times, last one
3 more bugmates