Based on Linux and with built-in 3D, SMS and web browsing courtesy of WebKit, it's an entirely self-contained and free mobile operating system.

Though there are only a few devices that currently support Android out of the box, it's designed as an open, free platform to simplify the process of programming mobile applications on Java.

Getting started

The Android SDK is easily installed, though it's worth noting a couple of things before starting. The latest version can be found at http://code.google.com/android/download.html.

The Windows version is archived in a zip file. We'd advise extracting the archive to the root of your main hard drive, taking care to maintain its folder hierarchy. Once extracted, you'll have a folder named something like 'android-sdk-windows-1.0_r1'.

We'll be using an IDE – the open-source development environment Eclipse – to examine and develop apps, so keep the path and path name simple. Rename the main folder 'android-sdk'.

You'll be adding the SDK path to Eclipse when we install it, but you can protect against problems by adding the path to Windows' system settings. Right-click on the My Computer icon, choose 'Properties' and click 'Advanced'. Click the 'Environment Variables' button. In the 'System Variable' section, click 'New' and create a new variable named 'android', giving the path 'c:\android-sdk\ tools', where 'c' is your main drive.

Android's application programming framework sits on top of Java – so you'll need to install the Java SE Development Kit (JDK) 6 before you go any further. The specs call for Sun JRE 5 or 6 too. You'll find the full package for Windows and other OSes at www.developers.sun.com/javase/downloads. By default, the JDK will install into the Program Files folder. Simplify folder names and move to the root of your local machine to ensure that all of your command line tools work properly.

Google recommends Eclipse as the IDE for Android, and the tools it supplies for the platform provide tight integration with the SDK. To get started with the program, grab it from www.eclipse.org/downloads. There are several versions listed, but we suggest you use the Eclipse for Java EE Developers, because it includes WST (Web Standards Tools), a set of components for working with web scripting languages in Java.

Again, install Eclipse in the root directory of your hard drive rather than your Program Files folder; this makes it easier to set up paths to the IDE and reduces the likelihood of errors caused by calls to DOS-based SDK components. The archive simply extracts – there is no installer. You can create a shortcut to the Eclipse runtime by selecting 'eclipse.exe' and [ALT]+dragging a copy to your desktop or Start menu.

Once Eclipse is installed, you can add the Android tools that are required to develop and work with existing apps. These integrate some Android SDK components into Eclipse. Start the program, then go to 'Help | Software Updates'. Select the Available Software tab.

Choose 'Add Site', type in the full URL (https://dl-ssl.google.com/android/eclipse) and then click 'OK'. The 'Software Updates and Add-ons' window should update, showing the newly entered URL. Open the hierarchy by clicking the '+' sign and then check the box next to 'Developer Tools'. Click 'Install'.

In the next window, check both 'Android Developer Tools' and 'Android Editors', then click 'Finish'. Finally, restart Eclipse.

Go to 'Window | Preferences' and choose 'Android' from the list. Browse to the Android SDK folder, or enter its path.

Android anatomy

The SDK comes bundled with a series of samples, which are handy for exploring the structure of a typical Android app. Let's have a look at one of them. Go to 'File | New | Project'. In the dialog that appears, choose 'Android Project' from the Android folder.

A 'New Android Project' dialog allows you to select 'Create project from existing source'. Browse to 'c:\ android-sdk\samples\Lunar Lander'. The package name, activity, application name and project name are filled in automatically, so just click 'Finish'.

This opens the application in the Eclipse workspace, allowing us to begin to explore the anatomy of the Android platform. There are two crucial parts that we need to look at. The first you'll find in the Project Explorer. This should already be open. If not, go to 'Window' and choose 'Close All Perspectives'.

Click the 'Open Perspective' button and choose 'Java (EE)'. Open the LunarLander hierarchy and choose 'src'. Next, open 'com.example.android. lunarlander' and double-click on 'LunarLander.java'.

This gives you your first view of Android's scripting environment – a simple user interface. In Android's jargon, this file is an 'activity', described as a "single focused thing that a user can do". Android's built-in activity class creates a window into which you can script other elements.

In this case, a second script file called 'LunarView.java' scripts the actual game, which is a series of 'views'. A view is a screen-sized element responsible for drawing content and handling events. The final 'src' file, 'R.java', is automatically generated and indexes all of the resources in an Android package.

Move down the hierarchy and you'll find a resources folder called 'res'. This contains bitmap images called from the Android scripts and an XML file in the Layout folder named 'lunar_lander.xml'. This defines the layout of the game in the target device using Android's XML schema.

The Android SDK includes an emulator that enables you to run apps and test your code without having to package it. Go to the Run menu and choose 'Run Configurations'. Double-click on 'Android Application', select 'New_configuration' and click the 'Browse' button. Choose 'LunarLander', click the 'Launch' button, select 'com. example.android.lunarlander. LunarLander' and click 'Run'.

The Android emulator will boot up and you should see the Android default screen with the screen locked. Click 'Menu' to start. The game Lunar Lander should load up, ready to play.

The procedure for creating a new Android app is similar to that of importing existing source files. Go to 'File | New', choose 'Project', select 'Android Project' from the New Project wizard, click 'Next' and then give the project a unique name.

When you've filled in the parameters, Eclipse will automatically generate a minimum set of files with a default layout, calling the built-in Android activity class, and write them to a folder in your workspace. You can then edit both the default Java script and 'main. xml' in the Resources folder to create your new application.