I was under the impression that the layout XML files are built into their respective activity *.java files, and that working with XML would mean that I should not be touching the files in /src.
However, every time I modify the XML (such as changing layouts, adding/removing buttons etc) the Java files don’t appear to be re-built.
Java files are completely independent of the layout XML files, as in changing the XML won’t magically make the Java file behave. XML layout is for UI and the Java file (if it’s an Activity), sets the UI to a layout file and also handles the logic.
To be a little more specific: The Java file (for an Activity) contains some important parts: namely setting the content view (via
setContentView()* and* using findViewById() to access the UI components. Without a source file the App wouldn’t run, XMLs are dependent on source.If you’re changing the content in the XML layout and reuploading to your phone, not touching the Java files at all, and the Java file has
setContentView(R.layout.your_xml_layout), rebuild and reclean (Project -> Cleanin Eclipse) your project.If on the other hand, you make a new XML file (eg my_new_layout), you have to modify the source code.
Eg