Introduction

In this article I will explain about the basic structure of an Android project and its major files and classes.

Background

I assume that you have some knowledge in Java programming and you know how to develop in Eclipse.
In order to develop an Android project, you have to install the Android plug in for Eclipse. In order to do that, choose (in the top menu)
Help -> Install new software, and in the window that opens, insert the address: "https://dl-ssl.google.com/android/eclipse/".
The installation wizard will guide you to download the full Android SDK if it is necessary.

Basic Android project structure

After you have installed all the plug-ins necessary for the development of an Android file, you can now begin to
develop an Android application.
From the top menu, choose File -> Project, and from the "New Project window", choose "Android Project". Follow the project setup wizard and after finishing the wizard, you will have a basic
Android application.
Every Android project contains several folders:

src: This folder contains the Java source files.

gen: Generated Java library, this library is for Android internal use only.

Res: Here we can store resource files such as pictures, XML files for defining layouts, and so forth.
Within this folder there are additional folders such as Drawable,
Layout, and Values.

Drawable: Here we store the various graphic files. We can see three types of drawable folders. This is because there are many
Android devices with different screen resolutions. By default, there are several
versions of this folder such as: Drawable-mdpi, drawable-hdpi, and so forth.
This is required in order to adapt to different screen resolutions.

Layout: This is the place for XML layout files. Layout files are XML files which define how various
Android objects (such as textboxes, buttons, etc.) are organized on the screen.

AndroidManifest.xml: This is the Android definition file. It contains
information about the Android application such as minimum Android version, permission to access Android device capabilities such as internet access permission, ability to use phone permission, etc.

MainLayout.xml: This file describes the layout of the page.
This means the placement of every component (such as textboxes, labels, radio buttons, user defined components, etc.) on the app screen.

Activity class: Every application that occupies the entire device screen needs at least one
class which inherits from the Activity class. One major
method is called OnCreate. This method initiates the app and loads the layout page.

This layout defines one object, a TextView. This is a text label and it is used when a programmer wants to place a text title in your application.

Activity class

One major class is the Activity class. We already defined this class in the
android.manifest file as the main activity class. Which is the first class
to be loaded and executed right after the Android application will be launched:

We can see here one major method called "onCreate" which is called when the Activity class is activated. In our specific example,
we define a layout file by the line setContentView(R.layout.main).

Let's have some code

We want to change the text in the label from "Hello World" to Hello "New Application".
First of all we have to link the label in the layout to a Java object. Before that we have to give an ID to our label object. This is done by opening our layout file, which is
called in our specific project "main.xml" and is located in the "res/layout" folder.

In the "TextView" element, we have to add the following attribute:

android:id="@+id/myLabel"

After that, let's open out main activity class, which in our case is called "MyfirstandroidprojectActivity.java" and add the following line in the "OnCreate"
method:

I am very interested in getting started with Android. Your article, to me, is lacking in depth.

There has to be more to the "Basic structure of an Android project" than what you have listed here.

I did not vote.

Thanks for sharing.

"the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)"No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011)
"It is the celestial scrotum of good luck!" - Nagy Vilmos (2011)
"But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)