Skip to content Skip to sidebar Skip to footer

Layoutinflater Performance

In Android reference, it says For performance reasons, view inflation relies heavily on pre-processing of XML files that is done at build time. Therefore, it is not currently

Solution 1:

Android's string processing is slow. So they actually do solve it by pre-processing the xml file. When you think about it, your layout xmls should be static cause any change you made on them will most likely also cause code changes. What is the point of being able to inflate a remote layout file if you can't use it without code changes especially when the string processing is that slow.

A better solution might be, writing a class file that creates the layout you need, put it in somewhere lets say internet. Than on the runtime you can download that file, load it as a class dynamically using reflection and use it.

Check out this links for further information.

Java Reflection - Dynamic Class Loading and Reloading

How to load a Java class dynamically on android/dalvik?

Post a Comment for "Layoutinflater Performance"