java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sid.test/com.example.sid.test.DynamicButtonAdd}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Programically add button on android

    Stack Overflow | 8 months ago | Siddhartha Sadhukhan
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sid.test/com.example.sid.test.DynamicButtonAdd}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  2. 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.
  3. 0

    RecyclerView's onClick method crashes the app

    Stack Overflow | 1 year ago | Crazy Ninja
    java.lang.IllegalStateException: Could not execute method of the activity
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Rolling a dice based on number of sides

    Stack Overflow | 1 month ago | user1696992
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  6. 0

    IllegalStateException in Fragment Activity

    Stack Overflow | 4 years ago | seekme_94
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
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:1976)
    2. android.view.ViewGroup.addView(ViewGroup.java:1871)
    3. android.view.ViewGroup.addView(ViewGroup.java:1828)
    4. android.view.ViewGroup.addView(ViewGroup.java:1808)
    4 frames
  3. Android v7
    AppCompatActivity.setContentView
    1. android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:271)
    2. android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:145)
    2 frames
  4. com.example.sid
    DynamicButtonAdd.onCreate
    1. com.example.sid.test.DynamicButtonAdd.onCreate(DynamicButtonAdd.java:106)
    1 frame
  5. Android Platform
    ActivityThread.performLaunchActivity
    1. android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    2. android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
    2 frames