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

Appcelerator JIRA | Nariman | 6 years ago
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

    {html}<div><p>Getting this exception regularly after adding a ScrollableViews (which works, before the exception) to TableView rows:<br></p> <pre> <code> var view1 = Titanium.UI.createView(); view1.add(thisLabelTitle); var view2 = Titanium.UI.createView({backgroundColor:'#456'}); view2.add(thisLabelDesc); var scrollView = Titanium.UI.createScrollableView({ views:[view1,view2] }); thisRow.add(scrollView); tableData.push(thisRow);</code> </pre> <p>java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.<br> at android.view.ViewGroup.addViewInner(ViewGroup.java:1970)<br> at android.view.ViewGroup.addView(ViewGroup.java:1865)<br> at android.view.ViewGroup.addView(ViewGroup.java:1822)<br> at android.view.ViewGroup.addView(ViewGroup.java:1802)<br> at ti.modules.titanium.ui.widget.TiScrollableView$ViewWrapper.doAttachView(TiScrollableView.java:72)<br> at ti.modules.titanium.ui.widget.TiScrollableView.setViews(TiScrollableView.java:371)<br> at ti.modules.titanium.ui.widget.TiUIScrollableView.processProperties(TiUIScrollableView.java:41)<br> at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.refreshControls(TiTableViewRowProxyItem.java:134)<br> at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:243)<br> at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:76)<br> at ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(TiTableView.java:202)<br> at android.widget.AbsListView.obtainView(AbsListView.java:1294)<br> at android.widget.ListView.makeAndAddView(ListView.java:1727)<br> at android.widget.ListView.fillDown(ListView.java:652)<br> at android.widget.ListView.fillGap(ListView.java:623)<br> at android.widget.AbsListView.trackMotionScroll(AbsListView.java:2944)<br> at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:2485)<br> at android.os.Handler.handleCallback(Handler.java:587)<br> at android.os.Handler.dispatchMessage(Handler.java:92)<br> at android.os.Looper.loop(Looper.java:123)<br> at android.app.ActivityThread.main(ActivityThread.java:4627)<br> at java.lang.reflect.Method.invokeNative(Native Method)<br> at java.lang.reflect.Method.invoke(Method.java:521)<br> at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)<br> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)<br> at dalvik.system.NativeStart.main(Native Method)</p></div>{html}

    Appcelerator JIRA | 6 years ago | Nariman
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  2. 0

    {html}<div><p>Getting this exception regularly after adding a ScrollableViews (which works, before the exception) to TableView rows:<br></p> <pre> <code> var view1 = Titanium.UI.createView(); view1.add(thisLabelTitle); var view2 = Titanium.UI.createView({backgroundColor:'#456'}); view2.add(thisLabelDesc); var scrollView = Titanium.UI.createScrollableView({ views:[view1,view2] }); thisRow.add(scrollView); tableData.push(thisRow);</code> </pre> <p>java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.<br> at android.view.ViewGroup.addViewInner(ViewGroup.java:1970)<br> at android.view.ViewGroup.addView(ViewGroup.java:1865)<br> at android.view.ViewGroup.addView(ViewGroup.java:1822)<br> at android.view.ViewGroup.addView(ViewGroup.java:1802)<br> at ti.modules.titanium.ui.widget.TiScrollableView$ViewWrapper.doAttachView(TiScrollableView.java:72)<br> at ti.modules.titanium.ui.widget.TiScrollableView.setViews(TiScrollableView.java:371)<br> at ti.modules.titanium.ui.widget.TiUIScrollableView.processProperties(TiUIScrollableView.java:41)<br> at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.refreshControls(TiTableViewRowProxyItem.java:134)<br> at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:243)<br> at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:76)<br> at ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(TiTableView.java:202)<br> at android.widget.AbsListView.obtainView(AbsListView.java:1294)<br> at android.widget.ListView.makeAndAddView(ListView.java:1727)<br> at android.widget.ListView.fillDown(ListView.java:652)<br> at android.widget.ListView.fillGap(ListView.java:623)<br> at android.widget.AbsListView.trackMotionScroll(AbsListView.java:2944)<br> at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:2485)<br> at android.os.Handler.handleCallback(Handler.java:587)<br> at android.os.Handler.dispatchMessage(Handler.java:92)<br> at android.os.Looper.loop(Looper.java:123)<br> at android.app.ActivityThread.main(ActivityThread.java:4627)<br> at java.lang.reflect.Method.invokeNative(Native Method)<br> at java.lang.reflect.Method.invoke(Method.java:521)<br> at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)<br> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)<br> at dalvik.system.NativeStart.main(Native Method)</p></div>{html}

    Appcelerator JIRA | 6 years ago | Nariman
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  3. 0

    the specified child already has a parent

    Stack Overflow | 6 years ago | Piyush
    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Create repeating detailed layout programmatically while using do in background

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

    Error swapping / adding an XML Fragment

    Stack Overflow | 6 years ago | Tony
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.owentech.simplefragmentswap/com.owentech.simplefragmentswap.mainActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.**

  1. filpgame 2 times, last 5 months ago
  2. Indri Yunita 6 times, last 6 months ago
  3. kuldeep 5 times, last 9 months ago
  4. harsha 1 times, last 9 months ago
  5. mrokay97 14 times, last 10 months ago
4 more registered users
11 unregistered visitors
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:1970)
    2. android.view.ViewGroup.addView(ViewGroup.java:1865)
    3. android.view.ViewGroup.addView(ViewGroup.java:1822)
    4. android.view.ViewGroup.addView(ViewGroup.java:1802)
    4 frames