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. voice call routing

Could you please give me information about how a voice call routing
happens in Android phone?
My intention is to understand the data and control flow.
or if this topic is already discussed on this forum, could you please
provide me the link?

2. Touchmode and OptionsMenu issue

You start your program and you are not in Touchmode.
You open the options menu by clicking on the "menu" hard-key (so you
are still not in Touchmode).
Now, instead of using the Dpad to select a specific option, you
<finger-touch> or <mouse-touch> the option you wish to select.  Now
you are in TouchMode.  However, there is an issue as to when Android
recognizes that you are in TouchMode.  If you perform an isInTouchMode
() query in the code for the option you have selected, it returns
false (i.e. "nope, not in TouchMode yet"). Even if you perform an
isInTouchMode() query in the code for onOptionsMenuClosed(), Android
still returns false (i.e. "nope, not in TouchMode yet").  But after
the app returns from the OptionsMenu, it is in fact in  TouchMode.

I don't think this is proper behavior, since I need to know at the end
of my OptionsMenu whether or not I will be returning to my activity in
TouchMode or not in TouchMode, so I can take appropriate action.  Is
there another method that runs after onOptionsMenuClosed() that will
register the proper TouchMode behavior?


3. Android USSD documentation

4. notepad error

5. webView load Data problem

6. Replace the current view by an other view

7. Change intent-filter category from within the app?