CSCI 490E/680K Assignment 1 - Android Programming - Spring 2012

01/30/2012

50 points


For this assignment, you will write an Android application that displays a single button (takes up the whole screen) on which the current date is displayed when the app first appears and again each time the button is clicked.  Therefore, it is actually a little more than the traditional "hello, world" program, in that it responds to a user event (a button click) and the display changes each time. You will run this app on the emulator, not on an actual mobile device.

Use Eclipse to develop this app.  Eclipse will create a default AndroidManifest.xml file, a default .java file, as well as a default main.xml file (along with other files and directories for your project).  The main.xml and  the .java file will need modification.

Notes:

When you start Eclipse, take care to specify the workspace where your project will be stored.  When using a lab computer, it should go on your default Novell network drive. Do not store your work on the local lab computer's hard disk  Do not tell Eclipse to not prompt you for a workspace location in the future.  Let me repeat: do not stop Eclipse from asking this question when it begins.

When you use Eclipse to create the project, name the Activity something meaningful like "HelloDate".

You will need to specify a package name for your source (and compiled) code.  Use:

edu.niu.cs.yourname.hellodate

(For "yourname" use your name.  Not "yourname")

You will need to slightly modify the main.xml file to include an entry for a Button component.

There are several ways to set up event response code in the Android world.  For this assignment, you must implement the OnClickListener interface for your Activity. This will be covered in class soon.  Other event response patterns will be covered later. 

Use the Java Date class to get a string representation of the current time and date:

new Date().toString();

and the Button's setText() method to display that date as the Button's caption.

Note that Java, Eclipse, the Android SDK, and at least one emulator (AVD = Android Virtual Device) must all be installed and configured before this program can be run.

You will demonstrate this program during class on the date due.  At that time you will turn in a printed copy of main.xml and your .java source code,  your name(s), the date, the assignment number, etc. This documentation will include an accurate description of what the program does as well as salient details on how it works.  Don't forget to format the program nicely.  This is a short program.  It should not be hard.  If the printer messes up your indentation or spacing, it is your responsibility to fix this before you hand it in.