Pages

Saturday, September 1, 2012

Building Your First Android Application

Let's build our first application. Launch Eclipse. click New Android App Project  in the toolbar or select New Project under File menu, then select Android Project. Choose you Application name and package name. Uncheck "Create custom launcher icon" and click next
Next, select Blank Activity
And finally, name your activity. The Title is the Application Title shown in Android launcher screen. Click Finish. 

ADT will generate various folders and files and you will see the layout graphical editor oped for you. This is how your app will appear when launched on device. The ADT has already added the bare bone required to run your app on Android platform.
For this excercis, we will use an android virtual device to run our first app. An AVD is a device configuration for the Android emulator that allows you to model different devices. To create an AVD:
  1. Launch the Android Virtual Device Manager:
    1. In Eclipse, click Android Virtual Device Manager from the toolbar.
    2. From the command line, change directories to/tools/ and execute:
      ./android avd
  2. In the Android Virtual Device Manager panel, click New.
  3. Fill in the details for the AVD. Give it a name, a platform target, an SD card size, and a skin (HVGA is default).
  4. Click Create AVD.
  5. Select the new AVD from the Android Virtual Device Manager and click Start.
  6. After the emulator boots up, unlock the emulator screen, you will see the app running.
In next post, we will learn about application building blocks and we will also examine project directory structure to better understand the app components, Till then play with your Android AVD. It runs the entire android stack and also comes with standard stock apps such as Maps, Browser, Contacts etc.