How to build oe develop first android app


Build your first android app

To build a first application in android you must need some packages to be installed in your system.

  • First need to download and install the Android SDK
  • To work with android, Java is must to be installed with jre/jdk.

Create Android Application

To create a simple application using Eclipse IDE. Follow the steps as it is.

Step 1: Open Eclipse IDE, then go to File->New-> Project and select Android New Application from the wizard list

Step 2: Now specify the name for your application in the following wizard.(e.g., Name your application as MyFirstApp). And keep all the other entries as it is till final step.

Step 3: Once you have completed the above steps, then you will be having the following screen with the anatomy of android application.

Anatomy of your project contains some folders and files.

src- It contains .java file of your project. By default is created. If you want you can change the name of your java file.

gen – It contains .R file, it is complier generated file  that references all the resources found in the project. It should not modify, like it as it is.

bin – It contains the android package files .adk, which is build by the ADT during the built process and everything which are all needed to run the android application.

res/drawable-hdpi – This is the directory for drawable object, that are designed for high density screen

res/layout – This is a director for files, that design your application’s user interface.

res/values – This is a directory for other various XML files, that contains the collection of resources. Such as strings and colors definitions.

AndroidManifest.xml – This file is used to describe the fundamental characteristics of the application and defines each of its component.

Step 4: The main activity code is a java file . This is the actual file which ultimately gets converted into Dalvik executable file and runs an application.

Here, R.layout.activity_main refers to the activity_main.xml file located in the res/layout folder.

Step 5: In Manifest file, you have to declare whatever the component you develop in your application. It resides at a root of the application project directory. It works like an interface between android OS and your application. If your not declaring the components which you have developed, then it will not be considered by the OS.

Step 6: String. xml file is located in res/values folder, and it contains all the text the application uses. This file is responsible for textual content.

Step 7: file is located in gen folder.It is glue between the activity file and resource file. It is automatically generated file so you should not modify the content of the file.

Step 8: activity.xml file is located in res/layout directory. You can modify the file very frequently by changing the layout of your application.

Here, RelativeLayout and TextView is used to design the user interface. Hence, @string/hello_world refers to the hello world defined in the string.xml file, which is “Hello World”.

Step 9: Run the application, open your project activity file and click on Run in toolbar.

Leave a Comment

Your email address will not be published. Required fields are marked *