CymChad / BaseRecyclerViewAdapterHelper

BRVAH:Powerful and flexible RecyclerAdapter
http://www.recyclerview.org/
MIT License
24.31k stars 5.16k forks source link

调用BaseNodeAdapter的nodeSetData()和nodeRemoveData()操作列表最后一个条目会崩溃报错 #3344

Open Elysionxi opened 4 years ago

Elysionxi commented 4 years ago

报错方法: /**

崩溃日志: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionBaseViewHolder{4b14998 position=23 id=-1, oldPos=-1, pLpos:-1 no parent} androidx.recyclerview.widget.RecyclerView{a59f2b1 VFED.V... ........ 0,100-720,1363 #7f0a03da app:id/rv_friend}, adapter:com.nn.accelerator.adapter.chat.ChatFriendAdapter@6247396, layout:androidx.recyclerview.widget.LinearLayoutManager@4c11b17, context:com.nn.accelerator.ui.activity.MainActivity@6cdc5f7 at androidx.recyclerview.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:6087) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6270) at androidx.recyclerview.widget.GapWorker.prefetchPositionWithDeadline(GapWorker.java:288) at androidx.recyclerview.widget.GapWorker.flushTaskWithDeadline(GapWorker.java:345) at androidx.recyclerview.widget.GapWorker.flushTasksWithDeadline(GapWorker.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:914) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:225) at android.app.ActivityThread.main(ActivityThread.java:7563) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:994)

lanfairy commented 3 years ago

遇到同样的问题了

dingshaoshuai888 commented 3 years ago

我也遇到了

com13117340768 commented 3 years ago

我也遇到了,有什么解决办法吗

smyyoukey commented 3 years ago

遇到同样的问题了,removeNodesAt(position: Int)这个函数有问题

sionsxie commented 3 years ago

`// 移除node自己 this.data.removeAt(position) removeCount += 1

val node = this.data[position] `

移除自己了 在获取自己,如果是最后一条数据,那就会IndexOutOfBoundsException 函数问题

CosmicRayLucky commented 3 years ago

我也遇到了

1226362423 commented 3 years ago

nodeRemoveData 也报错了

oudengding commented 2 years ago

@ChadCym 这个问题能修复吗

Smoker-X commented 2 years ago

好像有点印象,我解决的办法好像是去继承那个adapter,就是在报错那里判断一下就可以了吧。后续应该修复了吧 

薛雨森 Android开发工程师 玛格全屋定制

联系我

 

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年1月13日(星期四) 中午11:38 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [CymChad/BaseRecyclerViewAdapterHelper] 调用BaseNodeAdapter的nodeSetData()和nodeRemoveData()操作列表最后一个条目会崩溃报错 (#3344)

@ChadCym 这个问题能修复吗

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>

oudengding commented 2 years ago

最新版本这个问题还是有的

Smoker-X commented 2 years ago

哦哦,那我不清楚哦,你可以去问问作者看有没有把这个问题处理好并更新  

薛雨森 Android开发工程师 玛格全屋定制

联系我

 

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2022年1月13日(星期四) 中午11:44 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [CymChad/BaseRecyclerViewAdapterHelper] 调用BaseNodeAdapter的nodeSetData()和nodeRemoveData()操作列表最后一个条目会崩溃报错 (#3344)

最新版本这个问题还是有的

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.Message ID: @.***>

li-yu commented 2 years ago

可能的解决方案供参考:https://github.com/CymChad/BaseRecyclerViewAdapterHelper/issues/3065#issuecomment-1019767558

YehFeng commented 1 year ago

同样遇到这样的问题,有老哥有处理方案么