Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7021669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:28:51+00:00 2026-05-27T23:28:51+00:00

Reading the Online Developer Guide page on XML layouts , I’ve found the following

  • 0

Reading the Online Developer Guide page on XML layouts, I’ve found the following statement:

Your UI descriptions are external to your application code, which means that you can modify or adapt it without having to modify your source code and recompile.

I know about the many advantages of XML layouts and resources, but since the XML files are placed inside the APK, I think there’s no real way to modify the GUI without repackaging. I mean, most of us are using eclipse ADT plugin and ANT to package the apps, so there’s no real gain in not compiling the class files (since after modifying the resource files, a developer will have to repackage the app and produce a new APK file). Because of this, there is no way to redeploy just the GUI on devices without redeploying the entire APK.

If this supposition were true, then XML files are going to be the same during the lifetime of an APK file. I guess these files (specially layout ones) have to be parsed and processed at runtime (before an activity’s onCreate) which would be less efficient than building the GUI programmatically (like in Swing). Layout is not usually a bottleneck, but if I’m correct, I see here an small waste of time that could be better used (for instance, with animations).

Reading the same page, it states:

When you compile your application, each XML layout file is compiled into a View resource.

Inspecting one of my APKs, I’ve been looking for a precompiled file inside classes.dex and there’s nothing but my java classes and the R.class file. The layout XML files are inside the /res/layout folder, and there’s a file named resources.arsc which seems to contain info about other resources (strings, icons names), but nothing related to Views, I think (correct me if I’m wrong).

My questions:

  • Are XML layout files precompiled, and to which file?
  • If not, is there a compilation option to fully precompile layout info into a file for faster load time? (ideally, this would be a class file)
  • If not, is there a way to create that file in the first execution and cache it on the application installation folder, so that subsequent runtime executions can read that file instead of parsing the XML and have a faster load time?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:28:52+00:00Added an answer on May 27, 2026 at 11:28 pm

    If you have a gander at the class documentation for LayoutInflater, you’ll notice they say:

    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; it only works with an XmlPullParser returned from a compiled resource (R.something file.)

    So yes, layout files are indeed precompiled to some degree, and, judging by the above excerpt, it would be in the R$layout.class output file (but I’m not 100% sure on that). The precompiled layout file is located in your compiled APK package, as /res/layout/<layout_id>.xml. You’ll notice if you extract it and open it in a text editor that most plain-text XML elements have been mapped to some binary form.

    It would probably be the same kind of compression you can see in AndroidManifest.xml files that get packaged into the APKs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a junior VB.net developer with little application design knowledge. I've been reading a
I am after reading (preferably online) resources to guide newbies in the creation of
I'm learning Java by reading the online Java book, but im finding it hard
I'm looking for some advice on how to go about reading the online documentation
Reading this question I found this as (note the quotation marks) code to solve
Reading online about this topic is confusing. Is there a way to cut around
I have been trying to figure this out for quite sometime (reading online blogs
I've been spending a lot of time reading online presentations and textbooks about the
After reading online about hash-bangs. Ive decided to stick with our current url structure.
I've done a bit of reading online as to how to go about this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.