Creating a "Hello, World" Application using Eclipse
You want to use Eclipse to develop your Android application.
Install Eclipse, the Android SDK and the ADT plug-in. Create your project and start writing your app. Build it, and test it under the Emulator, from within Eclipse.
Once you have these items installed, you are ready to begin:
To get started, create a new project from the File->New menu.
Click Next. Give your new project a name, and click Next.
Select an SDK version to target. 2.1 gives you almost all the devices in use today; 3.x or 4.x gives you the latest features. You decide.
This figure shows the project structure expanded in the Project Panel at the right. It also shows the extent to which you can use Eclipse Auto-completion within Android - I added the 'gravity' attribute for the label, and Eclipse is offering a full list of possible attribute values. I chose center-horizontal, so the label should be centered when we get the application running.
In fact, if you set gravity to center_vertical on the LinearLayout and set it to center_horizontal on the TextView, the text will be centered both vertically and horizontally. Here's the version of the layout file main.xml which achieves this:
<?xml version="1.0" encoding="utf-8"?>
As always, Eclipse generates a compiled version whenever you save a source file. Also, in an Android project, it also runs an Ant Build to create the compiled, packaged APK that is ready to run. So you only need to run it. Right click on the project itself, and do Run As -> Android Project.
This will start the Android Emulator if it's not already running. The emulator will start with the word Android in typewriter text, then switch to the fancier Android Font with a moving white patch over blue lettering - remember the Microsoft Windows'95 startup?
After a little longer, your application should start up (and here we'll only show the screen shot of the application itself, since the rest of the Emulator view is redundant).
Hello World - Command Line