how to remove a view

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


Sponsored Links
 Hi,

How to remove a view added by addContentView method?

Thanks,
Billsen

--~--~---------~--~----~------------~-------~--~----~



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.

Thanks,
Billsen





--~--~---------~--~----~------------~-------~--~----~



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.

 http://code.google.com/android/reference/android/view/View.html #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. Device Interface to Android Phone

I'd like to develop a device that interfaces to a G1 or other upcoming
Android phone. The phone would be docked to this device in order to
provide some external functionality. The G1 has the following
interface - HTC ExtUSB(11-pin mini-USB 2.0 and audio jack in one) -
but I'm not sure if this is feasible to use. I haven't seen an
optional API that addresses the interface over a USB connection.

If the only way "standard" way to talk between a peripheral device and
an Android phone is Bluetooth, will the Bluetooth API be available
sometime soon? This setup would use Bluetooth to send/receive data and
the USB connection purely for power.


--~--~---------~--~----~------------~-------~--~----~

2. How to get an interface on a service without destroying the service at unbind

My service works exactly the way i want as long as i use start and
stop
and communicate using intents.

However my activity needs to change the state of my service as well as
retrieving
state information.

So i thought it would be nice to broadcast some kind of state_changed
event from
my service and use a binder interface to pull information from the
service or change
the services state based on user input.

This works fine too.
The only problem is that my service gets killed when i unbind it just
as the documentation says.

Is there any way to keep the service alive but still get an interface
to control it directly.
My activity offers the user a way to stop the service and the service
kills itself anyway
after it's work is done but i don't want the service to stop every
time the activity is destroyed.

Thanks in advance
Michael

--~--~---------~--~----~------------~-------~--~----~

3. unzip

4. help about SMS BroadcastReceiver conflict with GPS LOCATION_SERVICE

5. execute unix command from an android app

6. Pick multiple contacts from the contacts application

7. SAXParser fails on some RSS feeds