On Tue, Nov 23, 2010 at 4:10 PM, William Ferguson <william.ferguson.au@ gmail.com> wrote:
> Really? > Yup. > The Javadoc for View#inflate states: > > Inflate a view from an XML resource. This convenience method wraps the > LayoutInflater class, which provides a full range of options for view > inflation. > Parameters > context The Context object for your activity or application. > resource The resource ID to inflate > root A view group that will be the parent. Used to properly inflate > the layout_* parameters. > > > It doesn't mention that the resourceId needs to be a Layout or a ViewGroup. > It does state that it wraps the LayoutInflater class, and if you look at the inflate function in that class, it states: "Inflate a new view hierarchy from the specified xml resource. " Key words being "XML resource". > I don't really want to inflate the containing layout as its not required > and means I would need to remove the Views from it before adding them to the > dialog. > Then define separate layouts which just contain the pieces you want to inflate. > Can I define my 2 views directly in their own separate XML layout files, ie > with no containing (Linear)Layout and then inflate them? > Yes, that's exactly what you should do. > Ie is the ResourceNotFoundException because I am supplying a resourceId for > a View instead of the resourceId/name of layout file? > Precisely. ------------------------------------------------------------------------------------------------- TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago transit tracking app for Android-powered devices -- 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

