Hello Friends,
Welcome to the world of Android. When I started Android development I ran through various difficulties.So I wish my other fellow Android developer should not get same trouble.Hence Today I will explain you how to write simple Hello World example in Android.Now Let's Start..............
First step is to prepare Android development environment.Following are the requirement for Android development.I am using Eclipse(Helios) along with Window 7 (32-bit).
Basic Requirement for the Hello World
1) JDK
JDK is required for the installation of eclipse.To download JDK Click Here.
2) Eclipse Helios or Higher Version.
You can download eclipse Helios(32-bit) form here.For different version you can get it from here. Now extract the folder at some safe location and run the .exe file.Before starting eclipse it will ask you where you want to place your workspace.Locate it to some safe location.
3) Android-sdk
You can download Android-sdk for windows from here.For other operating system you can get it from here.Place it some safe location. And run SDK Manager in the android-sdk folder.
4) ADT-Plugin
For installing ADT-Plugin you need to start eclipse and follow the steps.
a) Click on Help > Install New Software.
b) Click Add, in the top-right corner.
c) In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
https://dl-ssl.google.com/android/eclipse
d) Click OK
e) Now select the check box and click next.
f) Follow the instruction and complete the installation.Now you need to restart eclipse.
Now you are ready with Android development Environment.
5) Android Emulator.
After setting Android Environment you need to create AVD(Android Virtual Device).AVD is used to run your Android application.It works same as like that of your android phone except certain feature.For that start eclipse and go to Windows> Android SDK and AVD Manager. You will get following screen.
From here go to New tab on right corner of the image.From where you can create AVD. Assign name whatever you want and assign the target.I am using Android 2.3 as a target.This is simple task you have to do for creating AVD.
From here onwards main task is started.Now move to left corner of your eclipse click on New > Project > Android Project. Now you need to set following parameter.
1) Name of your project > Hello World Tutorial
2) Build Target (Android 2.3)
3) Application Name :- Hello World Tutorial
4) Package Name :- com.android.pmts
5) Create Activity :- HelloAndroid
6) Min sdk version : 9
After completing all these fields you will get following screen.
And your project structure will look like this :-
Now open your HelloAndroid.java class and add the following lines.
// These lines are used to display the text.
Toast.makeText(getApplicationContext(), "Hi, This is Hello World Tutorial",2000).show();
So your HelloAndroid.java class will look like this :-
Now your First Hello World Tutorial is ready.Now you need to run this application.For that go to Run > run or use Ctrl+F11 or right click on your project i.e. Hello World Tutorial and select Run As > Android Application. It will start your AVD which we have crated previously and you will get the output something like shown below.
This is what the simple thing you have to do for creating Hello World program.
Hope you find it useful to start Android development.Because we believe in "Learning And Sharing". Please leave a comment so that we can improve this blog.
If you are having any queries you can send me mail at coe@parallelminds.biz
Welcome to the world of Android. When I started Android development I ran through various difficulties.So I wish my other fellow Android developer should not get same trouble.Hence Today I will explain you how to write simple Hello World example in Android.Now Let's Start..............
First step is to prepare Android development environment.Following are the requirement for Android development.I am using Eclipse(Helios) along with Window 7 (32-bit).
Basic Requirement for the Hello World
1) JDK
JDK is required for the installation of eclipse.To download JDK Click Here.
2) Eclipse Helios or Higher Version.
You can download eclipse Helios(32-bit) form here.For different version you can get it from here. Now extract the folder at some safe location and run the .exe file.Before starting eclipse it will ask you where you want to place your workspace.Locate it to some safe location.
3) Android-sdk
You can download Android-sdk for windows from here.For other operating system you can get it from here.Place it some safe location. And run SDK Manager in the android-sdk folder.
4) ADT-Plugin
For installing ADT-Plugin you need to start eclipse and follow the steps.
a) Click on Help > Install New Software.
b) Click Add, in the top-right corner.
c) In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
https://dl-ssl.google.com/android/eclipse
d) Click OK
e) Now select the check box and click next.
f) Follow the instruction and complete the installation.Now you need to restart eclipse.
Now you are ready with Android development Environment.
5) Android Emulator.
After setting Android Environment you need to create AVD(Android Virtual Device).AVD is used to run your Android application.It works same as like that of your android phone except certain feature.For that start eclipse and go to Windows> Android SDK and AVD Manager. You will get following screen.
From here go to New tab on right corner of the image.From where you can create AVD. Assign name whatever you want and assign the target.I am using Android 2.3 as a target.This is simple task you have to do for creating AVD.
From here onwards main task is started.Now move to left corner of your eclipse click on New > Project > Android Project. Now you need to set following parameter.
1) Name of your project > Hello World Tutorial
2) Build Target (Android 2.3)
3) Application Name :- Hello World Tutorial
4) Package Name :- com.android.pmts
5) Create Activity :- HelloAndroid
6) Min sdk version : 9
After completing all these fields you will get following screen.
And your project structure will look like this :-
Now open your HelloAndroid.java class and add the following lines.
// These lines are used to display the text.
Toast.makeText(getApplicationContext(), "Hi, This is Hello World Tutorial",2000).show();
So your HelloAndroid.java class will look like this :-
Now your First Hello World Tutorial is ready.Now you need to run this application.For that go to Run > run or use Ctrl+F11 or right click on your project i.e. Hello World Tutorial and select Run As > Android Application. It will start your AVD which we have crated previously and you will get the output something like shown below.
This is what the simple thing you have to do for creating Hello World program.
Hope you find it useful to start Android development.Because we believe in "Learning And Sharing". Please leave a comment so that we can improve this blog.
If you are having any queries you can send me mail at coe@parallelminds.biz





Thanks buddy its really helpful to me .I configure Android environment with the help of this blog..
ReplyDelete