Step 03 - Our version of “HelloWorld”
Launch Eclipse and create a new Android Project called SayHello (as above) similar to what you did in Step 02. Name your package ‘ie.wit’ (or accept the default again). Accept all the defaults, and it’s recommended you select Android 4.4 as the launch target platform (but any target will suffice for this particular lab). It’s also probably a good idea to run the App at this stage, so you can set up your AVD (if you haven’t done so already).
Edit your “strings.xml” file (in your res folder) and replace the current “resources” tag with the following - be careful if you have created an app which contains a ‘menu’ folder, this also includes associated resources, so don’t overwrite those resources, just add our ones at the end.
If you return to the “Resources View” you can see the graphical representation of the String resources you have set up (and edit them here if you need to).
Edit your “activity_hello.xml” in your layout folder and replace with the following
This will give you the following layout:
Once again, it’s worth running the app at this point to confirm everything is displayed the way we want it.
Firstly, open up the “HelloActivity.java” source file and add the following method
Note that we have no need for soem kind of Listener interface (ala swing developement) - our event handling is taken care of via the ‘onClick’ attribute in our xml layout, here’s what your completed Activity class should look like.
We will investigate this code more closely in the lectures.