I was interested in downloading the xml layout for UI views from a server and inflate that as an xml string.
What I see in the doc though is:
Therefore, it is not currently possible to use LayoutInflater with an XmlPullParser over a plain XML file at runtime; it only works with an XmlPullParser returned from a compiled resource (R.something file.)
I don't really understand the highlighted part (my emphasis).
If I have some "dummy" xml file to get the XmlPullParser could I inflate my xml string?
And in general if this is impossible what alternatives are there?
I mean besides that does not require a huge learning curve like react native
You can’t inflate view hierarchy from plain XML files, because of the unusual implementation of
LayoutInflater. According to the source code, the followinginflatemethods won’t work with a simple instance ofXmlPullParser.The implementation requires that the first argument
parseris an instance ofclass XmlBlock.Parser. The class implementsinterface XmlResourceParser, and the interface extends three interfaces:XmlPullParserAttributeSetAutoCloseableTherefore, simple
XmlPullParseris not enough for theinflatemethods. The APIs should be: