java.lang.IllegalArgumentException

called detach on an already detached child ViewHolder{154c4fd1 position=2 id=-1, oldPos=-1, pLpos:-1 scrap [attachedScrap] tmpDetached no parent}

Samebug tips6

If you're using notifyItemChanged(position) try changing it for notifyDataSetChanged(). This could be a bug with notifyItemChanged. Try dispatching all events as soon as they happen as well, since RecyclerView already bundles the updates by default.

This happens when you have android:animateLayoutChanges set to true in your XML file and you call notifyDataSetChanged(). To fix it, you have to set android:animateLayoutChanges to false.

Don't give up yet. Our experts can help. Paste your full stack trace to get a solution.

Solutions on the web12011

  • via GitHub by SaltedFish999
    , 9 months ago
    called detach on an already detached child ViewHolder{154c4fd1 position=2 id=-1, oldPos=-1, pLpos:-1 scrap [attachedScrap] tmpDetached no parent}
  • via GitHub by javyhoo
    , 3 months ago
    called detach on an already detached child ViewHolder{11eeac9 position=2 id=-1, oldPos=-1, pLpos:-1 scrap [attachedScrap] tmpDetached no parent}
  • called detach on an already detached child ViewHolder{9d6b1798 position=14 id=-1, oldPos=4, pLpos:4 scrap [attachedScrap] tmpDetached no parent}
  • Stack trace

    • java.lang.IllegalArgumentException: called detach on an already detached child ViewHolder{154c4fd1 position=2 id=-1, oldPos=-1, pLpos:-1 scrap [attachedScrap] tmpDetached no parent} at android.support.v7.widget.RecyclerView$5.detachViewFromParent(RecyclerView.java:710) at android.support.v7.widget.ChildHelper.detachViewFromParent(ChildHelper.java:284) at android.support.v7.widget.RecyclerView$LayoutManager.detachViewInternal(RecyclerView.java:7301) at android.support.v7.widget.RecyclerView$LayoutManager.detachViewAt(RecyclerView.java:7294) at android.support.v7.widget.RecyclerView$LayoutManager.scrapOrRecycleView(RecyclerView.java:7699) at android.support.v7.widget.RecyclerView$LayoutManager.detachAndScrapAttachedViews(RecyclerView.java:7682) at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:546) at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3315) at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3124) at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3568) at android.view.View.layout(View.java:16112) at android.view.ViewGroup.layout(ViewGroup.java:5185) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1195) at android.view.View.layout(View.java:16112) at android.view.ViewGroup.layout(ViewGroup.java:5185) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) at android.widget.FrameLayout.onLayout(FrameLayout.java:574) at android.view.View.layout(View.java:16112) at android.view.ViewGroup.layout(ViewGroup.java:5185) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813) at android.widget.LinearLayout.onLayout(LinearLayout.java:1722) at android.view.View.layout(View.java:16112) at android.view.ViewGroup.layout(ViewGroup.java:5185) at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1767) at android.view.View.layout(View.java:16112) at android.view.ViewGroup.layout(ViewGroup.java:5185) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813) at android.widget.LinearLayout.onLayout(LinearLayout.java:1722) at android.view.View.layout(View.java:16112) at android.view.ViewGroup.layout(ViewGroup.java:5185) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) at android.widget.FrameLayout.onLayout(FrameLayout.java:574) at android.view.View.layout(View.java:16112) at android.view.ViewGroup.layout(ViewGroup.java:5185) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1959) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1813) at android.widget.LinearLayout.onLayout(LinearLayout.java:1722) at android.view.View.layout(View.java:16112) at android.view.ViewGroup.layout(ViewGroup.java:5185) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:639) at android.widget.FrameLayout.onLayout(FrameLayout.java:574) at android.view.View.layout(View.java:16112) at android.view.ViewGroup.layout(ViewGroup.java:5185) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2548) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2233) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1330) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6705) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800) at android.view.Choreographer.doCallbacks(Choreographer.java:603) at android.view.Choreographer.doFrame(Choreographer.java:572) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786) at android.os.Handler.handleCallback(Handler.java:815) at android.os.Handler.dispatchMessage(Handler.java:104) at android.os.Looper.loop(Looper.java:192) at android.app.ActivityThread.main(ActivityThread.java:5865)

    Write tip

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

    Users with the same issue

    8 times, 1 month ago
    Once, 2 months ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 1 year ago
    Unknown user
    Once, 1 year ago
    4 more bugmates