Home‎ > ‎android‎ > ‎

Hello World


This program is purely an initial android program. It is resulted from command activitycreator.py .

A program supplied by Android to create a simple structured program. You can download the code on thislink. This code resulted from command sequences below:
  1. Open Shell Window ( command prompt shell bash shell)
  2. When PATH to Android tools directory is set, then just issue the command (in one line command):

    activitycreator -out HelloWorld com.iftitah.android.helloword.HelloWorld
  3. There will be a directory resulted named by HelloWorld. activitycreator is command to create activity which syntax like this (taken from command syntax when we don't supply parameters):
    Activity Creator Script

    Usage:
    activityCreator [--out outdir] [--ide intellij] your.package.name.ActivityName


    Creates the structure of a minimal Android application.
    The following will be created:
    - AndroidManifest.xml: The application manifest file.
    - build.xml: An Ant script to build/package the application.
    - res : The resource directory.
    - src : The source directory.
    - src/your/package/name/ActivityName.java the Activity java class. packageName
    is a fully qualified java Package in the format <package1>.<package2>... (with
    at least two components).
    - bin : The output folder for the build script.

    Options:
    --out <folder>: specifies where to create the files/folders.
    --ide intellij: creates project files for IntelliJ

    For Eclipse support, please use the ADT plugin.

The Codes can be run on emulator but should be compiled and transferred to emulator first. Below is the step by step to run the code:

  1. Change to HelloWorld directory, Issue compile command. in this example, I use Ant, from jakarta-ant. Just type:

    ant

    after building completed, then HelloWorld.apk will reside on bin/ directory.
  2. Run the Android Emulator, and wait until completed
  3. Transfer HelloWorld.apk to emulator with command:

    adb install bin/HelloWorld.apk
  4. Switch to Emulator, and change to Application, there will be HelloWorld icon. if it is not, then, one or more step before must watch carefully, maybe something wrong.
  5. Click the HelloWorld Icon, the application running, and show like below.



Was this information helpful ?

ċ
HelloWorld.zip
(5k)
Agus SA,
Jun 13, 2009, 6:09 AM
Comments