steele johnson wrote: > Hello, > I'm interested in instantiating a LinearLayout object from an xml file > that has a LinearLayout file configuration. I want to do this within a > method of my Activity. > > I tried findViewById() but that returned null. I've made sure that the > LinearLayout id is the one I'm passing. Note that this layout isn't > part of my screen, it's stand-alone, so I want to build a LinearLayout > object from the xml.
If you are starting from a layout XML and you want to create a brand-new View tree based on that layout (e.g., LinearLayout containing other widgets), that's called "view inflation" or "layout inflation". getLayoutInflater().inflate() should do the trick. This uses the android.view.LayoutInflater class. You can see inflation used in many of my Fancy ListViews posts: http://androidguys.com/?s=fancy+listviews -- Mark Murphy (a Commons Guy) http://commonsware.com Android Training on the Ranch! -- Mar 16-20, 2009 http://www.bignerdranch.com/schedule.shtml --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---