Code Monkey home page Code Monkey logo

Comments (4)

Kevin1466 avatar Kevin1466 commented on June 24, 2024

在已经加入adapter的情况下,setLoadingMoreEnabled为false之后是不是得notify一下?
报了这个bug 每次的position 都是item数量+1. 看了下源码 是不是在没有更多数据时,setLoadingMoreEnabled为false之后notify一下就可以解决?
Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{dddcd60 position=8 id=-1, oldPos=-1, pLpos:-1 no parent} com.jcodecraeer.xrecyclerview.XRecyclerView{529c22e VFED..... ........ 0,0-720,1218 #7f09054a app:id/a8u}, adapter:com.jcodecraeer.xrecyclerview.XRecyclerView$d@76ec3eb,
at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5715)

解决了吗?

from xrecyclerview.

dy1023348109 avatar dy1023348109 commented on June 24, 2024

在已经加入adapter的情况下,setLoadingMoreEnabled为false之后是不是得notify一下?
报了这个bug 每次的position 都是item数量+1. 看了下源码 是不是在没有更多数据时,setLoadingMoreEnabled为false之后notify一下就可以解决?
Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{dddcd60 position=8 id=-1, oldPos=-1, pLpos:-1 no parent} com.jcodecraeer.xrecyclerview.XRecyclerView{529c22e VFED..... ........ 0,0-720,1218 #7f09054a app:id/a8u}, adapter:com.jcodecraeer.xrecyclerview.XRecyclerView$d@76ec3eb,
at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5715)

解决了吗?

好了,就是在这个setLoadingMoreEnable之后notify一下就行,setLoadingMoreEnabled相当于改变了adapter的数据。

from xrecyclerview.

Kevin1466 avatar Kevin1466 commented on June 24, 2024

在已经加入adapter的情况下,setLoadingMoreEnabled为false之后是不是得notify一下?
报了这个bug 每次的position 都是item数量+1. 看了下源码 是不是在没有更多数据时,setLoadingMoreEnabled为false之后notify一下就可以解决?
Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{dddcd60 position=8 id=-1, oldPos=-1, pLpos:-1 no parent} com.jcodecraeer.xrecyclerview.XRecyclerView{529c22e VFED..... ........ 0,0-720,1218 #7f09054a app:id/a8u}, adapter:com.jcodecraeer.xrecyclerview.XRecyclerView$d@76ec3eb,
at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5715)

解决了吗?

好了,就是在这个setLoadingMoreEnable之后notify一下就行,setLoadingMoreEnabled相当于改变了adapter的数据。

你这个bug是必现的吗?为你的读源码定位问题、分析问题的能力点赞!我也试一下你的解决方案,但是我的crash好像不是必现,不太好判断对我是否有效。

from xrecyclerview.

Kevin1466 avatar Kevin1466 commented on June 24, 2024

在已经加入adapter的情况下,setLoadingMoreEnabled为false之后是不是得notify一下?
报了这个bug 每次的position 都是item数量+1. 看了下源码 是不是在没有更多数据时,setLoadingMoreEnabled为false之后notify一下就可以解决?
Fatal Exception: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{dddcd60 position=8 id=-1, oldPos=-1, pLpos:-1 no parent} com.jcodecraeer.xrecyclerview.XRecyclerView{529c22e VFED..... ........ 0,0-720,1218 #7f09054a app:id/a8u}, adapter:com.jcodecraeer.xrecyclerview.XRecyclerView$d@76ec3eb,
at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:5715)

https://stackoverflow.com/questions/35653439/recycler-view-inconsistency-detected-invalid-view-holder-adapter-positionviewh
这里有提出2个解决方案:

  1. 继承LinearLayoutManager
  2. The best solution is, clear the list every time before refresh RecyclerView.

第2个解决方案本质上和你的一样吗?

from xrecyclerview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.