Jonathan wrote: > Right now I have a class that extends LinearLayout and builds the view > inside of the constructor using a series of addViews. > > I wanted to move this into an XML file, so I have the same view > defined there. My problem is that I can't figure out how to load the > XML file in the constructor of the derived class. I looked up the > LayoutInflater stuff, but I wasn't entirely sure how to use it in that > context. Do I need to call addView() with the result of the > LayoutInflater?
Yes. Or, call inflate(R.layout.something, theParent, true), and it will add it for you. > The other issue is that the context object that is passed in doesn't > have the LayoutInflater methods... I'm not sure if I need an instance > of Activity to do that. Yes, you do. However, the Context for a View is going to be an Activity in most cases, AFAICT. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android App Developer Training: http://commonsware.com/training -- 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

