1 
• Android application development
Run Eclipse IDE 
2
Run Eclipse IDE 
3
• You can run android sdk manager to upgrade and install your android 
development tools! 
4
• For the first time, everything should be already installed and upgraded to 
latest version! 
• But, later you can use this tool to upgrade to recent versions. 
5
• Now, create a android virtual device using android virtual device manager. 
• This device will be the emulator which will run your android applications! 
6
• In the diagram, we see no virtual device, so we will need to create one. 
• In this stage, click New to create a new virtual device. 
7
• Give a name to your virtual device, e.g., MyAVD 
• Select a Device that will be emulated. In this case, select a 4.0” WVGA 
android device 
• Select other options as required and clock OK. 
8
• Your android virtual device is now ready to run your android applications! 
• Now, its time to create the application itself! 
9
• Create a New Android Application Project. 
• New->Android Application Project. 
10
• Give application name, package name, and select other options. Click 
Next. 
• Package name must be unique, so give it a unique name. 
• Select minimum required sdk as API8 
11
• Deselect the customer launcher icon, in this stage we do not need it. 
• We can test it later. 
12
• Select a blank activity, keep other things default. 
• After you finally click finish, your default android application will be ready 
and opened automtically 
13
• Your just created default application will look like this! 
• Android activity xml file is opened by default! 
14
Before you run your app, you should be aware of a few 
directories and files in the Android project: 
15
Folder, File & Description 
• 1 src 
This contains the .java source files for your project. By default, it includes 
an MainActivity.javasource file having an activity class that runs when 
your app is launched using the app icon. 
• 2 gen 
This contains the .R file, a compiler-generated file that references all the 
resources found in your project. You should not modify this file. 
• 3 bin 
This folder contains the Android package files .apk built by the ADT during 
the build process and everything else needed to run an Android 
application. 
16
Folder, File & Description(Cont.) 
• 4 res/drawable-hdpi 
This is a directory for drawable objects that are designed for high-density 
screens. 
• 5 res/layout 
This is a directory for files that define your app's user interface. 
• 6 res/values 
This is a directory for other various XML files that contain a collection of 
resources, such as strings and colors definitions. 
• 7 AndroidManifest.xml 
This is the manifest file which describes the fundamental characteristics of 
the app and defines each of its components. 
17
• Now, you will run your default application. You need to open 
the file. Open the activity java file under src folder. 
• Then click the run icon in the toolbar! 
18
• For the first time run, you will be asked to select different options for 
running 
• First, select Android Application in this stage. This means you are going to 
run the program as Android Application 
19
• Be patient for the first to run avd! It may take 10-15 minutes to start up for 
the first time. After it is loaded, your application will be installed and main 
activity will be started! 
• Congratulations on your first successful HelloWorld application! 
20
• Now, test with emulators different button, icons, screens if you are not 
already familiar with android phone! Remember, the response might be a 
bit slow in your pc! 
21
• Now, we will modify our HelloWorld android application! 
• Click on the activity xml file again! You will see the acitivity window! 
22
• Remove the TextView item first from the window! Then drag and drop a 
new TextView and a Button into your window. 
23
• To edit the properties of the button and textview you just added, go to 
activity xml view by clicking it. This will open the activity xml file rather 
than the graphical window! 
24
• Now, first set, text propertyof button to something “Say Hi!” and remove 
the text property of the TextView by deleting the line. 
• See the id of the textview, it will be used in the next task 
25
• Open your main activity java file. Add a new function and import the class 
View. This function will be the handler of the button click in your android 
application. 
26
• Now, add the following codes in your activity. This will set the text of the 
TextView to “Hello World” once the button is clicked! 
27
• Now, open activity xml file and then add the following codes. This will 
connect the button to your added function. When user will press the button, 
the function will be called! 
28
• Now, run your application again! Remember to keep the activity java file 
open. 
• You will see your newly created application and the button! Click the 
button! 
29
• Clicking the button, the textview will appear with text “Hello World”! 
Congratulation! You just completed an interaction between button, user and 
other component, i.e., TextView! 
30

Project anatomy & hello world

  • 1.
    1 • Androidapplication development
  • 2.
  • 3.
  • 4.
    • You canrun android sdk manager to upgrade and install your android development tools! 4
  • 5.
    • For thefirst time, everything should be already installed and upgraded to latest version! • But, later you can use this tool to upgrade to recent versions. 5
  • 6.
    • Now, createa android virtual device using android virtual device manager. • This device will be the emulator which will run your android applications! 6
  • 7.
    • In thediagram, we see no virtual device, so we will need to create one. • In this stage, click New to create a new virtual device. 7
  • 8.
    • Give aname to your virtual device, e.g., MyAVD • Select a Device that will be emulated. In this case, select a 4.0” WVGA android device • Select other options as required and clock OK. 8
  • 9.
    • Your androidvirtual device is now ready to run your android applications! • Now, its time to create the application itself! 9
  • 10.
    • Create aNew Android Application Project. • New->Android Application Project. 10
  • 11.
    • Give applicationname, package name, and select other options. Click Next. • Package name must be unique, so give it a unique name. • Select minimum required sdk as API8 11
  • 12.
    • Deselect thecustomer launcher icon, in this stage we do not need it. • We can test it later. 12
  • 13.
    • Select ablank activity, keep other things default. • After you finally click finish, your default android application will be ready and opened automtically 13
  • 14.
    • Your justcreated default application will look like this! • Android activity xml file is opened by default! 14
  • 15.
    Before you runyour app, you should be aware of a few directories and files in the Android project: 15
  • 16.
    Folder, File &Description • 1 src This contains the .java source files for your project. By default, it includes an MainActivity.javasource file having an activity class that runs when your app is launched using the app icon. • 2 gen This contains the .R file, a compiler-generated file that references all the resources found in your project. You should not modify this file. • 3 bin This folder contains the Android package files .apk built by the ADT during the build process and everything else needed to run an Android application. 16
  • 17.
    Folder, File &Description(Cont.) • 4 res/drawable-hdpi This is a directory for drawable objects that are designed for high-density screens. • 5 res/layout This is a directory for files that define your app's user interface. • 6 res/values This is a directory for other various XML files that contain a collection of resources, such as strings and colors definitions. • 7 AndroidManifest.xml This is the manifest file which describes the fundamental characteristics of the app and defines each of its components. 17
  • 18.
    • Now, youwill run your default application. You need to open the file. Open the activity java file under src folder. • Then click the run icon in the toolbar! 18
  • 19.
    • For thefirst time run, you will be asked to select different options for running • First, select Android Application in this stage. This means you are going to run the program as Android Application 19
  • 20.
    • Be patientfor the first to run avd! It may take 10-15 minutes to start up for the first time. After it is loaded, your application will be installed and main activity will be started! • Congratulations on your first successful HelloWorld application! 20
  • 21.
    • Now, testwith emulators different button, icons, screens if you are not already familiar with android phone! Remember, the response might be a bit slow in your pc! 21
  • 22.
    • Now, wewill modify our HelloWorld android application! • Click on the activity xml file again! You will see the acitivity window! 22
  • 23.
    • Remove theTextView item first from the window! Then drag and drop a new TextView and a Button into your window. 23
  • 24.
    • To editthe properties of the button and textview you just added, go to activity xml view by clicking it. This will open the activity xml file rather than the graphical window! 24
  • 25.
    • Now, firstset, text propertyof button to something “Say Hi!” and remove the text property of the TextView by deleting the line. • See the id of the textview, it will be used in the next task 25
  • 26.
    • Open yourmain activity java file. Add a new function and import the class View. This function will be the handler of the button click in your android application. 26
  • 27.
    • Now, addthe following codes in your activity. This will set the text of the TextView to “Hello World” once the button is clicked! 27
  • 28.
    • Now, openactivity xml file and then add the following codes. This will connect the button to your added function. When user will press the button, the function will be called! 28
  • 29.
    • Now, runyour application again! Remember to keep the activity java file open. • You will see your newly created application and the button! Click the button! 29
  • 30.
    • Clicking thebutton, the textview will appear with text “Hello World”! Congratulation! You just completed an interaction between button, user and other component, i.e., TextView! 30