Android CS323 Trish Cornez

Lab 2: Android Basics - User Interface



Note: Use a View-Control-Model for ALL apps.




Exercise 1:

Create the app shown below. Users are initially presented with an "unhappy" character with the corresponding text "I'm so hungry". After hitting the button "EAT COOKIE", the character becomes "happy" with corresponding text "I'm so full".

This app requires Model/View/Controller as follows:


NOTE: The image files should be placed in the mipmap directory.








Exercise 2:

Build the Coffee Ordering app shown below.
Assume a single coffee costs $4.00. Charge an additional $1.00 for chocolate and $.50 for whipped cream, per cup.
Use structure shown in the figureto guide you. Note: the action Background is removed from the app.



Coffee image :
Background color: #f7eac1

layout code





Coffee.java





MainActivity.java






Exercise 3:

Build the Shipping app shown below (see Chapter 2 Lab Example 2-1), which responds immediately to data input by users.
Do NOT include a button in this app. Instead, use the setOnEditorActionListener to indicate when the user has entered a shipping amount.
All items to be shipped will have a base cost of $3.00 for the first 16 ounces.
All items weighing more than 30 ounces will have a base cost of $4.00.
In addition, items weighing more than 16 ounces will have an added charge of $.50 for each additional four ounces.




Exercise 4:

Build the Burger Calorie app shown below (see Chapter 2 Lab Example 2-2). Users can select burger item options from the burger menu and compute the total calories of their favorite burgers with added condiments.