Templates by BIGtheme NET

Hello Android Example

Simple Example to Quickly Start Android Application:
Simple Android project in Eclipse IDE + ADT plugin, This ADT eclipse plug in help to create Android project creation and management, most likely 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
5) Code Simple activity, to display text.
6) Run from eclipse IDE
7) Demo

Tools used in this tutorial :
JDK 1.6 or above
Eclipse IDE 3.7 , Indigo
Android SDK

Simple steps to be follow to start,
1) Download And Install Android SDK
Download appropriate version of SDK, depends on your OS.
http://developer.android.com/sdk/index.html
2) Install ADT Eclipse plugin:
we need to add this plugin to eclipse.
In Eclipse IDE, select “Help” -> Install New Software…”, and put given URL:
https://dl-ssl.google.com/android/eclipse/

3) Create an Android Virtual Device (AVD):
Click on Android Virtual Device icon in eclipse, then click on create button and provide device details.
and click on OK button.
adv

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

5) Code Simple activity, to display text :
Locate the generated activity file, and modify a bit to output a string “Hello World”.
HelloWorldActivity.java

 
public class HelloWorldActivity extends Activity {
        /**
         * This will be called, when the activity is created first time. 
         * */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            TextView text = new TextView(this);
            text.setText("Hello World, Android Sample Apps");
            setContentView(text);
        }
    }

6) Run from eclipse IDE:
To run the application, right click on android project and choose run as Android application.
5

7) Demo :
The text message “Hello World, Android Sample Apps” will be displayed on device screen.
devicescreen

Trouble Shoot
If U get any error as given, while launching your device from ADV manager.
1
Refer the link http://stackoverflow.com/questions/26355645/error-in-launching-avd in case of error.