how to remove a view

by Billsen » Thu, 11 Sep 2008 12:59:30 GMT

Sponsored Links

How to remove a view added by addContentView method?



how to remove a view

by hackbod » Thu, 11 Sep 2008 14:49:58 GMT

 setContentView() replaces any existing views.  If you want finer-
grained control, you can setContentView() a top-level layout manager,
which you can then add and remove views in as you desire.


Sponsored Links

how to remove a view

by Billsen » Sat, 13 Sep 2008 02:23:06 GMT

 Would you please provide a little more information?  I loaded
R.layout.main by setContentView(), then added a view with
addContentView. I need to remove the view added by addContentView by
clicking a button.



how to remove a view

by Kavi » Sat, 13 Sep 2008 03:12:25 GMT

 Look at the setVisibility method to change the visibility options for
the view. #setVisibility(int)

how to remove a view

by Billsen » Sat, 13 Sep 2008 04:56:39 GMT

 Thanks for your help. It works with setVisibility.


Re: how to remove a view

by Guilo » Fri, 20 May 2011 04:29:40 GMT

 I know it is old but I have the same problem. I want next to change the view 
added by addContentView. Indeed recalling addContenView throws an Exception 

05-19 22:28:31.785: ERROR/AndroidRuntime(11210): 
java.lang.IllegalStateException: The specified child already has a parent. 
You must call removeView() on the child's parent first.


Other Threads

1. Share via SMS/Email/Facebook/Twitter - sample code?

Hi Guys,

Can anyone recommend an example or post that shows how to implement a
share via SMS/Email/Facebook/Twitter kind of thing for your app?

Muchas gracias in advance!!



2. Message not getting poste

Hello Moderators,

I have been trying to send the message below since yesterday and I
have tried posting it two times. I am not able to see it getting
posted to the group. Can you please let me know why?


Posting the following e-mail:

---------- Forwarded message ----------
From: Ray <>
Date: Mon, Oct 18, 2010 at 1:01 PM
Subject: App design question for multiple "data" connections
To: Android Developers <>


I am working on developing an application that requires me to
establish multiple client-server based connections. Connection can be
of two types where the Android device can be a server or a client. I
can have up to 6 - 8 connections. Once the connections are set-up they
need to be running in the background and are not typically affected by
UI actions.

Since each connection can be blocking, I am wondering what is a good
way to design this app. Should I have two services for handling the
server and client connections? Each service could have a "connection
manager" that can spawn new threads when necessary. Or does creating
two services even help? I presume spawning new processes would not be
good as they will be expensive.

I would appreciate any suggestions. Also, if this use case is not
typical please let me know if you need more information to make any



3. Question on versioning and localization of an android app

4. Return value from Parcelable.describeContents()

5. Loop an audio through microphone in Android ?

6. IntentService and Threads

7. Creating a listActivity with a button on the bottom