From ZERO to HELLO WORLD on Android

The fastest way to write a hello world application for Android using an IDE is to use Eclipse with the ADT and let those free products do the mundane tasks for you. Yeah, seems like cheating, but you probably want to use an IDE anyways and this gets you going in that direction. You can jump right into modifying the generated "hello world" program to learn by experimentation.

Here is how I recently wrote my first Android application using a Windows Vista machine. Everything downloaded was free.

  1. Installed the latest Android SDK. (http://developer.android.com/sdk/index.html)
  2. Added path to my SDK tools folder into the Windows PATH environment variable (Not sure this was really necessary.)
  3. Installed latest version of Eclipse and followed the installation instructions. (http://www.eclipse.org/downloads/) For me, this was version 3.5 of "Eclipse Classic."
  4. Installed the latest ADT into Eclipse (http://developer.android.com/sdk/adt_download.html).
  5. Created the program in Eclipse as follows...
    1. Selected FILE->NEW->PROJECT->ANDROID->ANDROID PROJECT
    2. Clicked Next
    3. Filled in "New Android Project" dialog as follows...
      1. Project name: MyHelloWorld
      2. Selected "Create new project in workspace"
      3. Checked "Use default location"
      4. Select Build Target as "Android 1.5" (because my phone is still on 1.5)
      5. Application name: MyHelloWorldApp
      6. Package name: com.myurl.example.myhelloworld
      7. Create Activity: Main
      8. Min SDK Version: left it blank
    4. Clicked Finish on the "New Android Project" dialog.
    5. Right clicked on the name MyHelloWorld in the Package Explorer and selected "Run As"->"Android Application"
    6. A simulation of an Android phone (5554) displayed with the word "android" on the display forever. I waited.
    7. Waited.
    8. Got impatient and googled for a solution to what seemed like nothing happening. Found a post that suggested manually kicking off the emulator manually, so I did. (emulator -avd test)
    9. Restarted everything, waited. Waited. Eventually the display said "Hello World, Main!". Success!

From there I modified the text and played around with different ways of generating text and graphics on the Android display. The default generated program uses the XML approach (the layout and text are encoded into XML files of your project.). The XML approach is recommended, but you can also use a procedural approach where you code everything using Java. Both examples and more are available at
http://developer.android.com/guide/tutorials/hello-world.html.

For more information on using Eclipse with the ADT check out http://developer.android.com/guide/developing/eclipse-adt.html.

TIP: I've noticed that sometimes the emulator does not display your application until you click the virtual MENU button.