CS 185C/286 - Lecture 5

Cover page image

Cay S. Horstmann

Lecture 5 Quiz 1

Put your answer into Piazza.

What is NOT true about RSS parser code example in Android Recipes Section 3.8?

  1. If the author had used the same trick as we did in the homework, the startElement method would have been shorter.
  2. The channel element must be handled in the startElement method.
  3. The title element must be handled in the endElement method.
  4. The inItem flag is necessary.

Lecture 5 Quiz 2

What is NOT true about the XML pull parser implementation of the RSS parser code?

  1. It is longer than the SAX implementation.
  2. Its structure is more aligned with the structure of the data to be parsed.
  3. Unlike the RSS parser, the pull parser checks that the document is valid.
  4. The statement
    if (parser.getEventType() != XmlPullParser.START_TAG) {
    is necessary.

Today's Lecture/Lab


Programming Menus

Contextual Menus

Storage Options

File Storage


Server Communication

Reading Before Next Class


Menu Items

  1. Continue with the code from the solution to homework 2.
  2. Add a menu with menu items to show correct responses, and one to hide them. What's the XML?
  3. Add a menu handler. Set or clear a Boolean flag showCorrectResponses. What's the code?
  4. Now you need to actually make it happen. Somewhere, where you populate the list, respect the flag. Where is that?
  5. How do you get the list to repopulate when the flag changes?

Saving State