2Lines Software
16Jan/092

Programming with Android Part 2

In this article we will install the tools for programming in Android and produce our first application.

If you're a more experienced developer or already have installed the tools feel free to skip ahead or take a long lunch and be back at 1:00. As I mentionned in Part 1 this series of articles is focused on getting a new developer up to speed with Android and programming in one afternoon.

So here we go;

12:00 Installing the Basics

The first step is to setup your environment for testing and development. We will need to download a couple of tools to begin with. Find the download for your OS and click through the installers on the page.

1. Sun Java JDK 1.5 or 1.6 (Sun calls it 5 or 6, why because marketing said so).

2. Eclipse 3.4 Ganymede
(Note: I didn't manage to get the SDK installed in Fedora Eclipse version,you might want to try another version if you are using that OS.)
3. And of course, the Android SDK

When installing the tools make sure that you follow the order. There are some dependencies that each will require.

12:30 Configuring Eclipse for Android

Once you have installed all the tools on your system we are ready to install the components that will help you debug and interact with the Android emulator.

Eclipse is configured with its own installer so this task is pretty routine*.

  1. Click help>>Software Updates
  2. Click the Available Software tab and select Add Site from the right hand side
  3. When the dialog box pops up enter the following address
    https://dl-ssl.google.com/android/eclipse/

    and select OK.

  4. The google address should appear in the main text column on the left. Select that address. Chose the developer tools and click Install in the top right
  5. Agree to the terms, download the tools and restart Eclipse.
  6. Coffee. After all you are working through lunch the least they can do is give you free coffee.
  7. Once Eclipse restarts, select Window>>Preferences
  8. Choose Android and select Browse to select your Android install directory from above.

*Eclipse 3.3 has slightly different method to install files. Check here for more details on that process

That's it. Android is now up and running in your Eclipse environment. We can begin to program our first Application. Not bad for a lunch hour.

1:00 Building Your First Application

Mandatory Hello Android World Application

Let's start by building the first hello, world application to ease you into the programming.

Here are the steps.

1. In Eclipse, click  File>>New>>Android Project and enter the project information.

Hello World Android Project

2. Click OK and Eclipse will build a shell project with all the necessary components.

That's it. One Hello, World project complete. However, you probably want to see it running. For this we are going to need a Run Configuration setup in Android.

Click  Run >> Run Configurations and setup a new configuration under Android.

Run Configurations

Choose the Activity using the Browse button and  give your configuration a name in the Name text box at the top of the panel.

Finally, click Apply and Run

Your computer will crunch away for a bit and eventually load the emulator and launch your program. If you get a screen that pops and looks like the image below, congratulations you have created your first Android application!

First Android Application

1:15 Relax

To summarize in 1 hour and 15 minutes we have built our working environment, created and launched our first Hello, World application. For the next installment we will be extending our application knowledge and getting into the guts of Android programming.

Part 3..

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Comments (2) Trackbacks (2)
  1. I wish to point out this article.

    Android First Example in Java: Hello World
    http://programmaremobile.blogspot.com/2009/01/android-first-example-hello-world.html

    It expain the steps(from java code to running into emulator) to make the first hello world without eclipse.
    I hope it is welcome!

  2. Hi,

    And thanks for the tutorial.

    However, Ive followed it and when running the app I only get a screen saying “ANDROID_”, not hello world. Any suggestions as to why?

    Best regards,
    Daniel


Leave a comment