CS 175/286 - Homework 1

Your task is to write an Android application that displays a quiz question, like this:

However, each time the program is run, the four answers should be randomly permuted.

You check in a project that solves the assignment together with a report in a file report.txt. Use plain text, not Word or RTF, or you won't get credit for the report. Make sure that report.txt and report.png are in the hw01 directory inside your repo.

In the report, answer the questions given in the step-by-step instructions below.

  1. Make a new project with application and project name Homework01 in the package edu.sjsu.cs175.hw01.
  2. Using the graphical layout builder, set up the question text and four answers, like in the lab. Make sure each element has an ID.
  3. When I did this, I got XML with messy alignment. I wanted the buttons below each other, and each option to the right of its button, aligned on the baseline. I had to fix up a couple of them, and it's pretty likely you will need to do the same. In your report, explain the changes that you made to the XML.
  4. Why did you get warning triangles next to each text view? (You don't need to fix them now.)
  5. Run your application. When you are done, commit and push your git repo. Paste the terminal contents from the push into your report. (This way, I'll be able to see your intermediate stages.)
  6. Now let's set the strings programmatically, not with the UI builder. Add code to set each textfield, so that the answers are in random order. Collections.shuffle is your friend.. Make sure it works and push your git repo. Paste the terminal contents from the push into your report. (Always do that when I ask you to push something. That way, I get the ID of the snapshot.)
  7. Now clone your repo into /tmp, then build and run the program from the command line (not Eclipse). How did you do that?
  8. Add a screen capture of the successful command-line build.
  9. Commit your report and screen capture into your original repo (not the clone) and push.

Make sure you push multiple stages. You will lose points if you don't do it, and I would also be very suspicious of any answer that fully develops without intermediate work. Also, be sure not to push any junk (classfiles, generated files, metadata). The .gitignore from the lab should take care of that.