Home  >  Forum  >  Android
Post New Query

Error: The specified child already has a parent. You must call removeView()


joined on
August 11,2014
Asked on August 20,2015
I am creating Android application in which I am adding image view pragmatically. On click of button, I need to hide/show image but getting error as below.

08-20 07:10:36.790: E/AndroidRuntime(980): Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
08-20 07:10:36.790: E/AndroidRuntime(980): at android.view.ViewGroup.addViewInner(ViewGroup.java:3561)
08-20 07:10:36.790: E/AndroidRuntime(980): at android.view.ViewGroup.addView(ViewGroup.java:3414)
08-20 07:10:36.790: E/AndroidRuntime(980): at android.view.ViewGroup.addView(ViewGroup.java:3359)
08-20 07:10:36.790: E/AndroidRuntime(980): at android.view.ViewGroup.addView(ViewGroup.java:3335)
joined on
June 15,2014
Replied on August 21,2015

Use 
imageView.setVisibility(View.GONE)

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us