Tuesday, March 4, 2014

Hello Android Demo With Source Code


Android Tutorial

Android, an open source operating system for mobile devices (Smartphone and tablet), led by Google. The Android SDK provides a set of tools and APIs to develop Android applications, using Java. So, if you know Java, Android programming is easy :)
In this series of tutorials, we show you the list of basic tutorials to get you start program Android easily.

Android Hello World Example

In this tutorial, we show you how to create a simple “hello world” Android project in Eclipse IDE + ADT plugin, and run it with Android Virtual Device (AVD). The Eclipse ADT plugin provided easy Android project creation and management, components drag and drop, auto-complete and many useful features to speed up your Android development cycles.
Summary steps to develop an Android application :
  1. Install Android SDK
  2. Install ADT Eclipse plugin
  3. Create an Android Virtual Device (AVD)
  4. Create Android Project with Eclipse (Wizard)
  5. Code it…
  6. Start it in Android Virtual Device (AVD)

    1. Install Android SDK

    Visit this Android SDK page, choose which platform and install it.
    In Android SDK installed folder, run “Android SDK manager”, choose what Android version you want to develop.

    2. Install ADT Eclipse plugin

    To integrate Android SDK with Eclipse IDE, you need to install Eclipse ADT plugin. Refer to this official guide – “Installing the ADT Plugin“.
    In Eclipse IDE, select “Help” -> Install New Software…”, and put below URL :   

    3. Create an Android Virtual Device (AVD)

    In Eclipse, you can access the “Android Virtual Device (AVD)” in Eclipse toolbar. Click “new” to create a AVD.

    4. Create Android Project

    In Eclipse, select “File -> New -> Project….”, “Android Project”, and input your application detail. Eclipse will create all the necessary Android project files and configuration.

    5. Hello World

    Locate the generated activity file, and modify a bit to output a string “Hello World”.
    javaFile : HelloAndroidActivity.java  
       
    package com.helloexample;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    public class HelloAndroidActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
        }
    }
     
  7. 6. Demo

    Run it as “Android Application“, see output.    

No comments:

Post a Comment