Anatomy of an Android App
Software projects ……mmmh ..have anatomy…yahhhh …sexy!
- Logical structure imposed due to the organization of code into packages.
- Structural organization of software code generally is a good practice makes things easier to find, but also maintainable over the long run as the project grows.
- Most importantly, knowing the project structure helps you track down program errors easilly!
Let’ take a look at the Project Structure generated by Eclipse ADT plug-in from our previous post:
Folder generated:
src/ – Source folder contains all your Java source code
gen/ – Generated folder contains source code generated by Android/Eclipse.
- Well it only contains R.java – one of Android’s most important file to perform name lookup/resolution and referencing.
- R.java is automatically generated by the build system and references your resources.
assets/ – Assets folder contains static files such as html which can be included in your program.
res/ – Resource folder contains your program resource files.
res/drawables/ – Contains image files eg. PNG, JPG etc but also drawables which are specified in XML format
res/layouts/ – Contains XML files to specify your application View layouts
res/values/ – Contains XML files where you can specify static string,text, numeric and other constant values.
Referenced Libraries/ – A folder containing third-party/downloaded JAR libraries which can be used in your Android App.
AndroidManifest.xml – A manifest file where you can specify all you Activities, Permissions, and other configurations.