Creating HelloWorld on Android

Always, when we start learning a new language, we start with a helloWorld program. A HelloWorld program just contains a simple code to say A hello within the system/environtment. So, We start our Android Learning with creating A helloWorld Program.

Below a step by step creating a helloWorld Program:
  1. Open up a Command Prompt window, go to the directory prepared for this (assume trial) and create workspace for HelloWord, code below:

    d:\trial>activityCreator --out HelloWorld com.mylearn.HelloWorld

    This command will create a directory under HelloWorld under trial, the HelloWorld directory contains some files and directory :

    src\ contains source code for HelloWord
    bin\ contains binary/intermediate code will be installed on the
    device/emulator, initialize empty first
    res\ contains resource file
    AndroidManifest.xml manifest
    build.xml information for building the program

  2. change to HelloWorld directory, and compile the program using ant

    d:\trial\helloword\>ant

  3. Start Android Emulator, you can issue the command to start Android Emulator from command line using command like this :

    d:\trial\helloworld\>start emulator.exe

    Android Emulator show up, initialize everything, and ready to use.

  4. Transfer the HelloWorld Program that has been compiled using adb tools command:

    d:\trial\helloworld\>adb install bin\helloworld.apk

    if the process running successfully, than we can access helloworld program from the emulator.

  5. Go to Application folder on the emulator, and there exist helloworld icon. click the icon, and the HelloWorld Program will show up.


0 comments:

Post a Comment