hi, I tried... but got nullPointerException when I call removeView()...
did I miss out something??? and how to setContentView() without given any parent??? any example??? sorry for any inconvenient... and thanks for reply... wesley. On Thu, Jan 8, 2009 at 10:17 AM, Mark Murphy <[email protected]>wrote: > > Wesley wrote: > >> removeView() is on ViewGroup, IIRC. > > oic.. > > > >> It sounds like you are calling setContentView(), supplying it a View > >> that is already tied to your existing content view. > > yup... any idea I can change the View that is already tied with existing > > content view?? possible??? > > I don't know how you got the second View that you want to use with > setContentView(). Ideally, if you are instantiating it or inflating it > yourself, you simply do not give it a parent, and then setContentView() > will work without issue. > > Otherwise, call getParent() on the View, cast the result to a ViewGroup, > and call removeView() on the ViewGroup with your View as the parameter. > At this point, you have a disassociated View that should work with > setContentView(). > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 2.0 Available! > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

