Saturday, June 16, 2012

First Android Application

First you have to create an android project using eclipse.
   File -> New -> Android Project, 
Then you can see 'New Android Project' window.

It consists of some fields, like Project Name, Build Target, Properties and Working Sets.
In my sample application,
Project Name   : FirstAndroidApp
Build Target      : Android 2.2
Package Name : com.firstandroidapp
(Do not need to edit auto filling fields)

Then you can see project is in the Project Explorer (left hand side of the eclipse).
Then explorer FirstAndroidApp -> src -> com.firstandroidapp and open FirstAndroidAppActivity class
Now you can see the code of that class.


Then explorer  res -> layout and open main.xml
Now you can see Graphical Layout and main.xml below and Form Widget on the left side.
You can add any widget and save the main.xml file
After that you can build the project
  Select project in Package Explorer right click on it and select Build Project 
After build the project, right click on the project Run As -> Android Application


Then you can see pop up the emulator and run the application.

You can download source code of the FirstAndroiApp and then import into the workspace. FirstAndroidApp.zip

No comments:

Post a Comment