java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

Stack Overflow | user1696992 | 3 weeks ago
tip
Do you find the tips below useful? Click on the to mark them and say thanks to rafael . Or join the community to write better ones.
  1. 0

    Rolling a dice based on number of sides

    Stack Overflow | 3 weeks ago | user1696992
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  2. 0
    samebug tip
    You cannot update your adapter contents in the background. Prepare your data on the background thread and then pass it to the main thread to update the adapter and call notify.
  3. 0
    samebug tip
    Also, you should dispatch events as soon as they happen, ReciclerView already bundles all updates.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Trying to include toolbar..but getting this exception

    Stack Overflow | 1 year ago | Rakesh
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  6. 0
    samebug tip
    The image you're trying to use is too big for Canvas, try compressing it or reducing resolution so the size becomes smaller.
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.IllegalStateException

    The specified child already has a parent. You must call removeView() on the child's parent first.

    at android.view.ViewGroup.addViewInner()
  2. Android Platform
    ViewGroup.addView
    1. android.view.ViewGroup.addViewInner(ViewGroup.java:4310)
    2. android.view.ViewGroup.addView(ViewGroup.java:4146)
    3. android.view.ViewGroup.addView(ViewGroup.java:4087)
    4. android.view.ViewGroup.addView(ViewGroup.java:4060)
    4 frames
  3. Android v7
    AppCompatActivity.setContentView
    1. android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:279)
    2. android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:145)
    2 frames
  4. com.example.thomb
    MainActivity$1.onClick
    1. com.example.thomb.tutorialspoint.MainActivity$1.onClick(MainActivity.java:25)
    1 frame
  5. Android Platform
    ActivityThread.main
    1. android.view.View.performClick(View.java:5280)
    2. android.view.View$PerformClick.run(View.java:21239)
    3. android.os.Handler.handleCallback(Handler.java:739)
    4. android.os.Handler.dispatchMessage(Handler.java:95)
    5. android.os.Looper.loop(Looper.java:234)
    6. android.app.ActivityThread.main(ActivityThread.java:5526)
    6 frames
  6. Java RT
    Method.invoke
    1. java.lang.reflect.Method.invoke(Native Method)
    1 frame
  7. Android
    ZygoteInit.main
    1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    2 frames