question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IllegalArgumentException: you can't move above of maxItemCount

See original GitHub issue

I’m getting the following error from users on many api’s and many different devices. Any idea why?

Fatal Exception: java.lang.IllegalArgumentException: you can't move above of maxItemCount
       at com.beloo.widget.chipslayoutmanager.layouter.AbstractPositionIterator.move(AbstractPositionIterator.java:17)
       at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fillWithLayouter(ChipsLayoutManager.java:852)
       at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.fill(ChipsLayoutManager.java:815)
       at com.beloo.widget.chipslayoutmanager.ChipsLayoutManager.onLayoutChildren(ChipsLayoutManager.java:719)
       at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3583)
       at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:3025)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1458)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:746)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:18799)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:898)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
       at android.view.View.measure(View.java:18799)
       at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1658)
       at android.view.View.measure(View.java:18799)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:898)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
       at android.view.View.measure(View.java:18799)
       at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:715)
       at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:139)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1458)
       at android.widget.LinearLayout.measureVertical(LinearLayout.java:746)
       at android.widget.LinearLayout.onMeasure(LinearLayout.java:629)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5951)
       at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
       at com.android.internal.policy.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2899)
       at android.view.View.measure(View.java:18799)
       at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2108)
       at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1224)
       at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1460)
       at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1115)
       at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6023)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
       at android.view.Choreographer.doCallbacks(Choreographer.java:670)
       at android.view.Choreographer.doFrame(Choreographer.java:606)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:5461)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:11

github_iconTop GitHub Comments

5reactions
alexjiexiaoqicommented, Apr 26, 2018

it sames that the pos belong to the previous data. For example, you put datas which size is 20, and scroll it to the bottom, so the current pos is 20, but now you want to update the recycleview, you put another datas which size is 10, so the pos 20 is big than 10. so you’d betther scroll the recycleview to the start positon.

public void setDatas(List<T> list) { /** first scroll current pos to 0, then change the datas to update recycleview */ recyclerView.scrollToPosition(0); datas = list; mAdapter.setData(datas); }

1reaction
AmritpalSingh5commented, Aug 20, 2019

Just setAdapter() every time instead of notifyDataSetChange() . it solved my crash.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LinearLayoutManager is already attached to a RecyclerView ...
I find the solution for my problem. The reason is my LayoutManager is a singleton object (because I use Dagger to Inject it)....
Read more >
Spring Cloud
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, ...
Read more >
Patch - Minecraft Forum
Players with Minecraft: Xbox 360 Edition saves will be able to import their worlds to Xbox One. Unfortunately, you won't be able to...
Read more >
Newest 'bottomnavigationview' Questions - Stack Overflow
There is bottom navigation in which fragments have been used for each item, when I go to other activity from profile icon, it...
Read more >
limit can be checked with bottomnavigationview ...
IllegalArgumentException : Maximum number of items supported by BottomNavigationView is 5. ... For example, you can see the example in output shown above....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found