Wednesday 24 December 2014

Hello World application in Android


This tutorial explains how to create a hello world program in Android.

For setting up the Android development environment check out this blog.

Create a new Android project:


1)      Open the Eclipse IDE, Click on the menu item File à New à Android Application Project

 
2)      Once you select the menu, you will be able to find a screen to enter the details of the
new project enter the details as show in the screenshot below.


Application Name: Name that appears to users after the app is installed.
Project Name: Name for uniquely identifying the project
Package Name: Package namespace for your files, this should be unique             across all packages installed on the Android system.
Minimum Required SDK: Lowest version of Android your application supports, to support as many devices as possible, you should set this to the lowest version available that allows your app to provide its core feature.
Target SDK: Indicated the highest version of Android you have tested the application.
Compile With: Indicated the version with using the program is compiled and build.
Theme: Specifies the Android UI for your App.


The Minimum Required SDK, Target SDK & Compile With are noted with the Android API number.

3)      Just Click on Next in Configure Project screen


4)      You can configure the icon for your application in this screen, select any image icon from your computer. This image will display as the icon for your android application and click Next.


5)      In the Create Activity screen click on Next leaving it to the default selected value “Blank Activity”


6)      Now provide the name for your activity, rename that to SayHello and click on Finish.


7)      This will open a screen similar as below,


8)      1)      Under your project folder structure go to res à Values à strings.xml, change the value of the string hello_world to “Hello Kumar”,  i.e  Hello Kumar!

9)      Just Right Click on your project name select Run As à Android Application.


10)   Once the AVD is launched and the project is deployed you should be able to see the application running successfully as below.


If you go back to the application list page you will be able to see your application with the icon that you selected, sample screen shot below.


Finally successfully we have created the hello world application and ran it successfully.




No comments: