Hm, yes, I was wrong. So, no official way of doing it, yet. Lets hack then :) I can suggest the following: put layout in a dummy project, generate .apk from it. Program would download this apk, install it, and then query xml resource via PackageManager.
Dmitry On 15 сен, 15:52, Argy <[email protected]> wrote: > Important: For performance reasons, view inflation relies heavily on > pre-processing of XML files that is done at build time. Therefore, it > is not currently possible to use LayoutInflater with an XmlPullParser > over a plain XML file at runtime. > > So I guess it has to be a pre-processed XML file and not a plain XML > file. > That's bad news... it would be great if there was a workaround for > this one... > > Now I have to parse the XML myself and create the layout... > Any other suggestions? > > Thanks, > Argy > > On Sep 15, 8:36 am, "Dmitry.Skiba" <[email protected]> wrote: > > > Hm, at a first glance this is possible: several LayoutInflater.inflate > > methods accept XmlPullParser, and you can certanly create one for an > > arbitrary Reader. > > > Dmitry > > > On 15 сен, 06:48, Argy <[email protected]> wrote: > > > > I'm just wondering if I'm able to create a View from an external XML > > > source. > > > As I was reading, you must place the XML layout inside the res/layout > > > and when you compile it, you can load the layout by typing > > > setContentView(R.layouts.my_layout). > > > What if I have this XML layout online (on a website) and I want to > > > create the layout on runtime? > > > Is there any way to do this? > > > Or I have to parse the XML and create the layout (hard-coded)? > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

