Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the parsing of xml files in android happen at runtime or compile time?

I am far from an expert when it comes to understanding the minutia of code compilation. But I am learning some android development, and I noticed how layouts and other things are essentially parsed out of xml. I was wondering if this parsing happens at compile time or at runtime? If it is at runtime, it seems like there might be some overhead associated with parsing out a very complex layout.

Hope that this question isn't too vague or doesn't make sense.

like image 811
wfbarksdale Avatar asked Oct 09 '22 19:10

wfbarksdale


1 Answers

The parsing of the XML to create the layout happens at compile time. You will notice that if anything in your XML is malformed, the compiler will throw an error.

Certain aspects of the layout such as calculating relative position happen at run time, but there is nothing that can be done to avoid that.

like image 115
Ryan Berger Avatar answered Oct 13 '22 10:10

Ryan Berger