Android Basics:Understanding the structure of an android application

By

April 8, 2012AndroidNo comments

This is the part of Android Development series

1.What is Android ?
2.Hello world mobile application using android.
3.What is Android activity ?
4.Understanding Android layouts
5.Introduction to AndroidManifest file

Before we get started to build an android application it is essential to understand the complete structure of an android project.I am using Eclipse IDE for development which I have mentioned in earlier tutorial on how to setup eclipse.

Create a new android project in eclipse IDE with a project name ,package name and build target.

Note: A package name will be unique for each application.

Once you create a project you will see a list of folders created in the project explorer shown below.

 

/Src

Src folder will contain your java class files.This is same like other java projects you create using eclipse.

/gen

This is also a java source folder like src but it will be generated by the android system and will contain the class file called R.java

/Android x.x

This folder will be created based on the version of android you are choosing while creating the project.It will contain the library files(jar) corresponding to android platform.Certain features in android are available only on select platforms.For example: Action bars will not be available in android 2.2 but will be available in android 3.0

/assets

Resources needed by the program will be stored here in raw format.

/res

Primary resource folder that contains the images,layouts,sounds etc.The files other than the java classes will be found here.

/res/drawable

All the images/icons are stored in this folder.It will be classified in three folders where the android screen density comes into picture.

ldpi-Resources for low-density screens (~120dpi).
mdpi-Resources for medium-density screens (~160dpi).
hdpi-Resources for high-density screens (~240dpi).

/res/layouts

Layout files normally XML files will be stored in this folder.Each screen in android will be displayed based on the layout specified.If html is for webpages then layout is for android app.Specifies the skeletal structure for UI.

/res/values

It contains the name value pairs which can be used by the app.It is basically an xml file which is used to store the array,string,color values which is separated from source code.

/AndroidManifest.xml

Like an index page for a book, manifest file for an android application is first read when an application is launched.It defines the main activity,view,permissions and other meta information primarily needed by all android apps.

/proguard.cfg

This file is used by proguard tool which obfusticates the android classes that will be very difficult to reverse engineer.This is used while licensing your application.

 

Do you think this Android Development tutorial is useful ?? If Yes, Share/Comment below.You can also Get Regular Updates. Subscribe to Free RSS Feeds or Email Updates. Follow us on  Twitter @Devlup and Like us on Facebook.

Related posts:

Leave a Reply