CymChad / CymChad/BaseRecyclerViewAdapterHelper

设置空布局,一开始list有数据,没问题,后来在刷新数据后list成为空列表,再次submitList会闪退

Open
#3,860 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
24.6k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionVH{1a32058 position=1 id=-1, oldPos=1, pLpos:-1 scrap [attachedScrap] tmpDetached no parent} androidx.recyclerview.widget.RecyclerView{ea16bee VFED..... ......I. 0,0-1080,1710 #7f0901df app:id/rv_list}, adapter:com.dmapp.location5g.adapter.ImsiListAdapter@2888ad1, layout:androidx.recyclerview.widget.LinearLayoutManager@1b1a88f, context:com.dmapp.location5g.activity.ImsiListActivity@79b4b6f
at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:6544)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6727)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6688)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6684)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2362)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1662)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1622)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:687)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep1(RecyclerView.java:4550)
at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3975)
at android.view.View.measure(View.java:25166)
at com.scwang.smart.refresh.layout.SmartRefreshLayout.onMeasure(SmartRefreshLayout.java:600)
at android.view.View.measure(View.java:25166)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7109)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1580)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:849)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:728)
at android.view.View.measure(View.java:25166)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7109)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145)
at android.view.View.measure(View.java:25166)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7109)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1580)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:849)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:728)
at android.view.View.measure(View.java:25166)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7109)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:25166)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7109)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1580)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:849)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:728)
at android.view.View.measure(View.java:25166)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:7109)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:1139)
at android.view.View.measure(View.java:25166)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3738)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2363)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2760)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2235)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9043)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1280)
at android.view.Choreographer.doCallbacks(Choreographer.java:1019)
at android.view.Choreographer.doFrame(Choreographer.java:911)
12:33:37.247 E at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1248)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8673)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported sequence in ImsiListActivity with ImsiListAdapter: submit an initially populated list, refresh it to an empty list, then submit another list. Read the RecyclerView stack trace and verify that the sequence no longer produces an IndexOutOfBoundsException; the payload does not name a source file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.