Home  >  Forum  >  Android
Post New Query

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



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)



Replied on August 21, 2015
Use 
imageView.setVisibility(View.GONE)

Write Answer







©2019 concretepage.com | Privacy Policy | Contact Us