CS 185C/286 - Lecture 6

Cover page image

Cay S. Horstmann

Lecture 6 Quiz 1

Put your answer into Piazza.

Android 3.0 adds the ability for you to define the on-click behavior for a menu item in XML, using the android:onClick attribute. The value for the attribute must be the name of a method defined by the activity using the menu. The method must be public and accept a single MenuItem parameter—when the system calls this method, it passes the menu item selected.

Is this a good idea?

  1. Yes—then one can just add android:onClick=onOptionsItemSelected to each menu item without having to install any listeners.
  2. Yes—then one can install different listeners for each item without having to have a switch statement in the listener.
  3. No—then one needs to have a different listener for each item.
  4. No—then one doesn't separate UI layout from behavior.

Lecture 6 Quiz 2

Which of the following “useful methods” are actually useful (i.e. can't be done with the normal java.io.File API)?

  1. getDir
  2. deleteFile
  3. fileList
  4. None of them

Today's Lecture/Lab


App Functionality

Android-Specific UI

Plain Old Java Code

Platform Abstraction

Unit Tests

Server Part

Reading Before Next Class


Checking Out and Running the App

  1. Scribe: Inside your workspace directory, make a directory lab06 for the report.
  2. Driver: Outside your workspace directory, make a directory lab06.
  3. In that directory, run git clone https://github.com/cayhorstmann/cinequest.git
  4. Follow these instructions to build the project.
  5. Target Android 2.2. How did you do that?
  6. Run the app. What happens?
  7. What's the first film of March 1?

Running a Test

Making a Change

Making a Patch