java.lang.IndexOutOfBoundsException: Inconsistency detected.

错误全图
java.lang.IndexOutOfBoundsException: Inconsistency detected._第1张图片

先说下我碰到这个错误的情况,在使用recyclerview时,要将一个item数据从列表中删除,在使用了list.remove(Object)方法后需要刷新界面,这里我使用错了方法,使用如下

  notifyItemChanged(position);

然后就报了如上错误
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{4fbedad position=1 id=-1, oldPos=1, pLpos:-1 scrap tmpDetached no parent}

解决,只需要将上面刷新界面的方法改成

 notifyItemRemoved(position);

你可能感兴趣的:(inconsiste,detected,indexoutof,我的错就是你的错)