Home  > Resources  > Blog

Getting Started With Android 2.2

 
June 29, 2010 by Bibhas Bhattacharya
Category: Mobile Computing

I have often found that Google’s quick start guide for Android development lacks crucial details. Finally, I decided to do something about it. This tutorial should help an absolute new comer to Android programming.

Before you start, make sure that you have these installed:

  • JDK 6. Just JRE is not enough. You will need to install full JDK.
  • Eclipse Galileo

Install Android 2.2 Platform

Download android SDK 2.2 from this link. Unzip the ZIP file under C:\. This should create the C:\android-sdk-windows folder.

Add C:\android-sdk-windows to the PATH environment variable.

Log off and log back in for the change to PATH to take effect.

Now, we will download the Android 2.2 platform.

From the C:\android-sdk-windows\tools folder, run android.bat.

image

Select Settings on the left hand list.

Check the Force https checkbox as shown above.

image

Select Available Packages.

On the right hand side, select SDK Platform Android 2.2, API 8, revision 1 as shown above.

Click Install Selected to start installation.

image

Click Install.

image

When installation finishes, click on Close.

Install Eclipse Plugin

Make sure that you have added the SDK directory to PATH environment variable.

Launch Eclipse.

Select Help > Install New Software.

Click the Add button to add a new site.

image

Add the https://dl-ssl.google.com/android/eclipse/ URL as the new site. Click OK.

image

Expand Developer Tools and check Android Development Tools.

Click Next.

image

Click Finish.

image

Click OK.

image

Click Yes to restart Eclipse.

Create a Virtual Device

An Android Virtual Device (AVD) is a device (phone) emulator. You will use it to test and debug applications.

From Eclipse menubar, select Window > Preferences.

image

Select Android.

Click Browse button and select the directory where the SDK was installed (C:\android-sdk_r06-windows in our case).

Click OK.

From menubar, select Window > Android SDK and AVD Manager.

Select Virtual Devices on the left.

Click New.

image

Enter my_avd as the name. Select Android 2.2 as the target.

Click Create AVD.

Close the AVD manager.

Write a Simple Application

We will now develop a basic application to test our development environment.

in Eclipse, select File > New > Project from the menubar.

image

Expand Android and select Android Project.

Enter the values as shown below.

image

Click Finish.

Expand the HelloWorld project and then src > com.webage.hello.

image

Open HelloActivity.java.

Change the onCreate method as follows.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TextView tv = new TextView(this);
    tv.setText("Hello World!");
    setContentView(tv);
}

Organize imports (Control+Shift+O).

Save changes.

Test the Application

While the editor for HelloActivity.java is active, from the menubar, select Run > Run.

image

Select Android Application. Then click OK.

System will start the Android Virtual Device. This can take up to 5 minutes. While the device is booting, the screen will look like this.

image

Then, you will see the home screen.

image

Finally, the application will be started.

image

To exit the application, click the home button.

image

Congratulations, you have successfully installed the Android development environment and tested your first Android application.

Follow Us

Blog Categories