Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
690810892 opened this issue Apr 17, 2024 · 2 comments

Comments

@690810892
Copy link

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)

@690810892
Copy link
Author

690810892 commented Apr 22, 2024

这个问题是因为用了com.scwang.smart.refresh.layout.SmartRefreshLayout,不兼容

@zhaobinsir
Copy link

在setEmptyView之前加入notifyDataSetChanged、应该是缓存的数据没更新、导致的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants