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


Solutions on the web381

Solution icon of stackoverflow
via Stack Overflow by user1696992
, 8 months 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 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 shaileshe2logy
, 11 months 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 AnmAtAnm
, 11 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.

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

Solution icon of appcelerator
via Appcelerator JIRA by Hardik Amal, 3 months ago
The specified child already has a parent. You must call removeView() on the child's parent first.

Solution icon of appcelerator
via Appcelerator JIRA by Nariman, 1 year ago
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, 9 months ago
6 times, 10 months ago
5 times, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
18 more bugmates