Structure of Android Application

Developing an Android project, you have to install the Android plug-ins for Eclipse and at least have some knowledge of Java programming.

After installing all the plug-ins for an Android file, you can begin to develop an Android application.

Android uses packages not only to arrange the code in an application but to manage the application themselves.

android application structure
The above diagram shows the basic building blocks of an Android application. Android application in Eclipse or in any development tool have a pre-defined structure with code and resource organized into a number of folders.

Every Android project contains several folders, like:

Folder NameDescription
srcThe 'src' stands for Source Code. It contains the Java Source files.
genThe 'gen' stands for Generated Java Library. This library is for Android internal use only.
Android 2.2The Android Framework Library is stored here.
assetsIt is used to store raw asset files.
libsIt contains private libraries.
resThe 'res' stands for Resource file. It can store resource files such as pictures, XML files, etc. It contains some additional folders such as Drawable, Layout and Values.

anim: It is used for XML files that are compiled into animation objects.
color: It is used for XML files that describe colors.
drawable: It is used to store various graphics files. In Android project structure,

there are three types of drawable folders,
1. drawable-mdpi
2. drawable-hdpi
3. drawable-ldpi

The above drawable folders are required in order to adapt to different screen resolutions.

layout: It is used for placing the XML layout files, which defines how various Android objects such as textbox, buttons, etc. are organized on the screen.

menu: It is used for defining the XML files in the application menu.

raw: The 'raw' stands for Raw Asset Files. These files are referenced from the application using a resource identifier in the R class.
For example, good place for media is MP3 or Ogg files.

values: It is used for XML files which stores various string values, such as titles, labels, etc.

xml: It is used for configuring the application components.
AndroidManifest.xmlThis file indicates the Android definition file. This file contains the information about the Android application such as minimum Android version, permission to access Android device capabilities such as Internet access permission, phone permission etc.
default.propertiesThis file contains the project settings, such as build the target. Do not edit this file manually. It should be maintained in a Source Revision Control System.
Proguard.cfgThis file defines how ProGuard optimizes and makes your code unclear.
MainLayout.xmlThis file describes the layout of the page. So all the components such as textboxes, labels, radio buttons, etc. are displaying on the application screen.
Activity classThe application occupies the entire device screen which needs at least one class inherits from the Activity class. OnCreate() method initiates the application and loads the layout page.