java.lang.IndexOutOfBoundsException

tip

Try to use notifyDataSetChanged() instead of notifyItemRemoved(), there's a bug in RecyclerView and notifyItemRemoved() does not work in some environments.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Bug report
    via GitHub by petar19992
    ,
    • java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHolder{3115d7ae position=2 id=-1, oldPos=-1, pLpos:-1 no parent}\ at android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition(RecyclerView.java:4247) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4378) at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4359) at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961) at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370) at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333) at android.support.v7.widget.LinearLayoutManager.scrollBy(LinearLayoutManager.java:1161) at android.support.v7.widget.LinearLayoutManager.scrollHorizontallyBy(LinearLayoutManager.java:1006) at android.support.v7.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:3803) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5910) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)

    Users with the same issue

    Hiren AmaliyarHiren Amaliyar
    10 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    brunosatrianibrunosatriani
    7 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    34 more bugmates