java.lang.IllegalStateException

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


Solutions on the web22935

Solution icon of github
via GitHub by manumaticx
, 1 year ago
The specified child already has a parent. You must call removeView() on the child's parent first.

Solution icon of github
via GitHub by mori-honest
, 1 year ago
The specified child already has a parent. You must call removeView() on the child's parent first.

Solution icon of github
via GitHub by d-faure
, 1 year ago
The specified child already has a parent. You must call removeView() on the child's parent first.

Solution icon of github
via GitHub by d-faure
, 1 year ago
The specified child already has a parent. You must call removeView() on the child's parent first.

Solution icon of github
via GitHub by DFoxinator
, 1 year ago
The specified child already has a parent. You must call removeView() on the child's parent first.

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

Solution icon of github
via GitHub by sakae-nakajima
, 7 months ago
The specified child already has a parent. You must call removeView() on the child's parent first.

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

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

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

Stack trace

  • 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(ViewGroup.java:4310) at android.view.ViewGroup.addView(ViewGroup.java:4146) at android.view.ViewGroup.addView(ViewGroup.java:4087) at android.view.ViewGroup.addView(ViewGroup.java:4060) at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:279) at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:145) at com.example.thomb.tutorialspoint.MainActivity$1.onClick(MainActivity.java:25) at android.view.View.performClick(View.java:5280) at android.view.View$PerformClick.run(View.java:21239) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:234) at android.app.ActivityThread.main(ActivityThread.java:5526) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

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

14 times, 1 year ago
2 times, 7 months ago
6 times, 8 months ago
5 times, 11 months ago
Samebug visitor profile picture
Unknown user
Once, 11 months ago
18 more bugmates