Deploying the Android App in Eclipse

Open the Hello world project if this isn’t already open. In the package explorer panel, expand the HelloWorld folder to reveal the files associated with the project.
Hello World in Eclipse Package Explorer


Expand the res folder followed by the layout folder and double click on the activity_main.xml.  The Hello World app will be displayed.


activity_main.xml file in eclipse


Click on the magnifying glass that contains the number 1 above the preview window to enlarge the app or click on the positive + magnifying glass.

Eclipse zoom


The main things of interest on this android app are the title and the text view.  The TextView is used to display text.  Click on the Hello World! TextView.  The properties on the right hand side will appear.  If the properties window isn’t displayed go to Window –> Show View –> Outline.

Eclipse view outline


There are various option that can be set for this TextView including text colour, the size, font family and the actual content.  Click on the property that is labelled as Text.

Eclipse Properties


Click in the area highlight above and enter the words Hello Android.  This will change the TextView on the app.  Notice that a small yellow icon appears next to the TextView.  This appears as a warning that we are using hard coded text string and not text from a resource file.  Resource file will be explained later but for now just ignore the warning.  The program that does this checking for you is called the Lint Tool.  When a warning or error appears it will either display a yellow warning icon for warning or a red cross icon for an error.  In addition to this lint will information you the error by displaying a number as in the screen shot below.

Lint Warning in Eclipse


Click on this red icon.  A lint warning window will be displayed explaining that there is a warning relating to your layout file.

Lint Eclipse Warnings in Layout file

Lint Eclipse Warnings in Layout file

A description of the error is also displayed letting you know what the issue is and some information regarding why it isn’t good practice to do this. One of these is that the application language can’t be translated. Click the OK button.

If the emulator isn’t already running, click on the Android Device Manager and select the Nexus S configuration.

Android Virtual Device in Eclipse


When the emulator has loaded, right click on the project name and select Build Project.  Confirm that there are no errors and right click the project name again but this time select, Run As –> Android Application.

Android Emulator

Switch to the emulator and you will see your app running containing the words Hello Android.

Android Programming Deploying the App Device

Next Android Game Programming Week 2- Day 3.0  Deploying the App >>