Friday, June 14, 2013

Running Your App - BYFAA

If you followed the previous lesson to create an Android project, it includes a default set of "Hello World" source files that allow you to immediately run the app.
Before you run your app, you should be aware of a few directories and files in the Android project:
AndroidManifest.xml
The manifest file describes the fundamental characteristics of the app and defines each of its components. You'll learn about various declarations in this file as you read more training classes.
src/
Directory for your app's main source files. By default, it includes an Activity class that runs when your app is launched using the app icon.
res/
Contains several sub-directories for app resources. Here are just a few:
drawable-hdpi/
Directory for drawable objects (such as bitmaps) that are designed for high-density (hdpi) screens. Other drawable directories contain assets designed for other screen densities.
layout/
Directory for files that define your app's user interface.
values/
Directory for other various XML files that contain a collection of resources, such as string and color definitions.

Run on the Emulator


Whether you're using Eclipse or the command line, to run your app on the emulator you need to first create anAndroid Virtual Device (AVD). An AVD is a device configuration for the Android emulator that allows you to model different devices.
Figure 1. The AVD Manager showing a few virtual 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<sdk>/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.
To run the app from Eclipse:
  1. Open one of your project's files and click Run  from the toolbar.
  2. In the Run as window that appears, select Android Application and click OK.
Eclipse installs the app on your AVD and starts it.

Get ready for the next tutorial which is very interesting

No comments:

Post a Comment