Lab 1 - Simple UI and Persisting Activity State

Android Application Development 1


Purpose

This lab is designed to give you practice:


Part 1 - Exercises

Do the textbook exercises shown below:

Note: Use the Empty Activity template, and set the min API to 18 or higher.

Note: that for exercise 3-1, there is a starter project in the source code provided by the publisher of the textbook. It is identical to the finished version of 2-2, so you can just use your completed exercise 2-2 instead of the starter project.


Upload a text file to the LMS in which you will report, for each exercise above, whether you:

  1. Followed all the steps shown in the book and successfully compiled and ran the program (where applicable).
  2. Loaded the completed solution, experimented with the code, and ran the program (where applicable).
  3. Read through the steps and inspected the relevant code listings without writing or running a program.
  4. Didn't do any of the above.


Part 2 - Click Counter App

Create an app that counts the number of times a button is clicked and that has a button that lets the user reset the count back to zero.

  1. Create a new Android app using the Empty Activity template. Accept all the default settings.
  2. Using the existing Constraint Layout, add two buttons and an additional TextView to the XML file. (You can use either the designer or directly edit the XML source)
  3. Write the event handlers for the application. One of the event handlers will contain code to increment a count and display it. The other will contain code to reset the count back to zero and display it.
  4. Optional, extra credit. Figure out how to store and retrieve the count so that it isn't lost when the screen is rotated.
Zip the folder containing your project and upload it to the LMS.
Creative Commons License
Android App Development 1 Course Materials by Brian Bird are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.