Per Ola is currently working as CTO in mBricks (www.mbricks.no) and is a Microsoft Device Application Development MVP. Per Ola got his bachelor degree in Software Development back in 2005. Since 2005 he has been passionately working with mobility projects on a wide range of technologies and areas of use. Driven by his passion for this craft he spends a lot of his time off work to further explore technology possibilities or new programming languages or techniques. He finds himself privileged to be able to make a living from one of his hobbies. Per Ola has experience from a wide range of projects covering developing applications for the consumer market and for the enterprise market. He has had several different roles: developer, architect, team leader, project manager, technical resource in pre-sale and strategic planning. Per Ola is a DZone MVB and is not an employee of DZone and has posted 26 posts at DZone. You can read more from them at their website. View Full User Profile

Getting Started with Android development using Eclipse

11.09.2010
| 22227 views |
  • submit to reddit

Finally I found time to start looking at Android development. In the past I have been developing mobile applications on Java ME, Windows Mobile and Windows Phone 7, now it’s time to have a look at the Android platform. In this post I will describe what you need to do to get started with Android development.

At developers.android.com there is a good Quick Start guide explaining step by step what you need to do to get started:

  1. Start with installing JDK 6
  2. Download Eclipse Classic 3.6.1 and unzip it on your disk (I unzipped it to location c:\eclipse)
  3. Download Android SDK (for Windows platform in my case) and unzip it on your disk (I unzipped it to location c:\android sdk)
  4. Add the android sdk location to your path
  5. Install the Android Development Tools (ADT) plugin in Eclipse. Remote update/install site: https://dl-ssl.google.com/android/eclipse/
  6. Add Android platforms and components to your SDK by running the SDK Manager. I chose accept all and install, this will give me all available Android platforms and components including Google API, Usb driver, samples and documentation.

You have now installed all you need and you can now follow the steps below to create your Android project and run the application from Eclipse. Once again developers.android.com have a good tutorial on how to create Hello World application:

  1. Set the Android SDK location in Eclipse. Select Window –>Preferences –> Android and browse to your Android SDK location. When you click Apply you will see the list of SDK targets available.
  2. Create Android Virtual Device (AVD) in Eclipse. Select Window –> Android SDK and AVD Manager –> Virtual Devices and click on New. Give the AVD a name, select your target and click Create AVD. I named my AVD “Android_2.2_AVD” and selected the Android 2.2 target
  3. Create a new Android project. Select File –> New project –> Android –> Android project and click next. Then fill in the project details: Project name, Build target, Application name, Package name and Activity must be specified.
  4. The project is now created and is visible in the Package explorer, I called the project HelloAndroid so the class HelloAndroid.java is generated for me. In the HelloAndroid.java you can add code for your GUI:
    package no.techcon.android;

    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.TextView;

    public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TextView tv = new TextView(this);
    tv.setText("My very first Android application");
    setContentView(tv);
    }
    }
  5. Run the application. Select Run –> Run and run as Android. The Android Emulator will now start and boot up (takes a while to boot the first time). When the emulator is finished booting your application is installed and started in the emulator:

You are now ready to continue developing Android applications and explore the possibilities within the Android SDK.

 

From http://breathingtech.com/2010/getting-started-with-android-development-using-eclipse/

Published at DZone with permission of Per Ola Sæther, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Tags: