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

IndexOutOfBoundsException #1195

Closed
XD-Z opened this issue May 22, 2023 · 3 comments · May be fixed by #1210
Closed

IndexOutOfBoundsException #1195

XD-Z opened this issue May 22, 2023 · 3 comments · May be fixed by #1210

Comments

@XD-Z
Copy link

XD-Z commented May 22, 2023

java,lang.IndexOutOfBoundsException: Inconsistency detected,Invalid item positi 5(0Ffset:5)state6 androidx,viewpader2.widaetViewPager2$RecyclerViewlmplid7f386e VFED..... ........ 0,0-1024,766 #5, adapter:com.bool.loncin.ui.circle.adapterBicoseRecommendBannerAdapter6570bbf,layout:com.youth.banner,util.ScrollSpeedlanger0698679, context:com.bool.loncin.ui.mainMainActivity@8ef4f9c
at androidx.recyclerview.widgetRecyclerViewSRecyclertrybetViewHolderForPositionByleadline(RecyclerViem.java:6364)at androidx.recyclerview.widget.Gapllorker.prefetchPositionW/ithDeadline(GapWorker.java:288)at androidx.recyclerview,widget. Gaplorker,flushTaskWithDeadline(GapWorker,iava:345)at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(Gapllorker.java:361)at androidx.recyclerview.widget.GapWorker.prefetch(GapWorker.java:368)at androidx.recyclerview.widget.GapWorker.run(GapWorker.java:399)
at android.os.Handler.handleCallback(Handler.java:938)at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.Toop(Looper.java:233)
at android.app.ActivityThread.main(ActivityThread.java:8068)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller,run(RuntimeInit.java:631)at com,android.internal.os,ZygoteInit,main(ZygoteInit,iava:978)

@XD-Z
Copy link
Author

XD-Z commented May 22, 2023

这个问题具体应该怎么解决,复现方法,后台删除一条数据,刷新的时候,必然会闪退,报IndexOutOfBoundsException异常

@byzyhm
Copy link

byzyhm commented Nov 16, 2023

遇到了,去复现一下

@pengxiyang
Copy link

ffdf130e9ddfa649a53c99144a1d4da

@OverRide
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
try {
//try catch一下
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
}
}
这个方法我试了依然闪退,上面图是我按照网上博主建议写的,数据清除时就刷新界面,然后好了

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