crash on RecyclerView.java:5421 validateViewHolderForOffsetPosition

165 Views Asked by At

Help me how to handle this crash, on this recyclerview I use an adapter in it and in the scroll function I use NestedScrollView when positionViewHolder position=111 id=-1, oldPos=110, pLpos:110

android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition (RecyclerView.java:5421)
android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline (RecyclerView.java:5603)
android.support.v7.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5563)
android.support.v7.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5559)
android.support.v7.widget.LinearLayoutManager$LayoutState.next (LinearLayoutManager.java:2229)
android.support.v7.widget.LinearLayoutManager.layoutChunk (LinearLayoutManager.java:1556)
android.support.v7.widget.LinearLayoutManager.fill (LinearLayoutManager.java:1516)
android.support.v7.widget.LinearLayoutManager.onLayoutChildren (LinearLayoutManager.java:608)
android.support.v7.widget.RecyclerView.dispatchLayoutStep1 (RecyclerView.java:3644)
android.support.v7.widget.RecyclerView.onMeasure (RecyclerView.java:3103)
android.view.View.measure (View.java:21051)
android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:715)
android.widget.RelativeLayout.onMeasure (RelativeLayout.java:461)
android.view.View.measure (View.java:21051)
android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:715)
android.widget.RelativeLayout.onMeasure (RelativeLayout.java:461)
android.view.View.measure (View.java:21051)
android.support.v4.widget.NestedScrollView.measureChildWithMargins (NestedScrollView.java:1449)
android.widget.FrameLayout.onMeasure (FrameLayout.java:185)
android.support.v4.widget.NestedScrollView.onMeasure (NestedScrollView.java:515)
android.view.View.measure (View.java:21051)
1

There are 1 best solutions below

0
On

It would be helpful if you could post your adapter actual code. You shouldn’t need a nested scrollview in a recycler view, but I suggest you make sure the height/number of items is correct.