I want to use external(like /storage/sdcard0/main.xml) xml as Layout by LayoutInflater. So I found use external xml by XmlPullParser. But It didn't work!!
How to write xml source which is operating on XmlPullParser and LayoutInflater?
I want to use external(like /storage/sdcard0/main.xml) xml as Layout by LayoutInflater. So I found use external xml by XmlPullParser. But It didn't work!!
How to write xml source which is operating on XmlPullParser and LayoutInflater?
LayoutInflater does not work on arbitrary xml at runtime. See the comment on LayoutInflater.inflate.
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.
The platform performs a downcast in Resources.java that makes this assumption.
// XXX note that for now we only work with compiled XML files.
// To support generic XML files we will need to manually parse
// out the attributes from the XML file (applying type information
// contained in the resources and such).
XmlBlock.Parser parser = (XmlBlock.Parser)set;