Friday, June 15, 2012

Hierarchy of eclipse package explorer for android application.

When we expand our project in package explorer view, for example, the expansion of Bean Matrix Demo Test will carries the folders shown below in figure.


These are the default folders created by New Android Project wizard. Other folders include bin, libs and referenced libraries. You won’t see the bin library initially, because it’s hidden from view in the latest version of the ADT. The libs and referenced libraries folders don’t show up until you add a third party library and reference it in your project. The two other files in the project are AndroidManifest.xml and project.properties.

The src folder, source folder in Android project includes stub MainActivity.Java file. They contain the java code of the application.

The gen folder contains java files generated by ADT. These files have references to various resources placed in the application. It contains a special class R which refers to all the resources like images in the application and so on.  We can use this class as a means of short-hand operator in our source code. This particularly powerful with the code-completion features of IDEs like Eclipse which quickly locates the specific reference you are looking for. This again help you to make sure that the resource you are going to use is really exists.
The assets folder is empty by default and is used to store raw asset files. Asset file may be a file that you may need for the application to work. For example, A file that contains data in a proprietary format for consumption on the device. If you are going to develop an application that has its own dictionary for word lookup, you need to place it in assets folder.
The res folder contains all the resources required like images, layouts and values. Resources are external files (non-code files) that are used by your code and compiled into your application at build time. Resources are externalized from source code, and XML files are compiled into a binary, fast loading format for efficiency reasons. Strings are compressed into a more efficient storage form.
The AndroidManifest.xml is a required file for every Android application and is located in the root folder of the application. It describes global values for your package, including the application components (activites, services, etc) that the package exposes to the ‘outer world’ what kind of data each of our activities can handle and how they can be launched.
The project.properties file helps you identify the default properties of the Android project (such as Android Version). It contains project settings such as build target. This file is integral to the project.


No comments:

Post a Comment