There are two versions of this homework, depending on whether you managed to get HW2 to run, or not.
Your task is to enable users to save preferences, and save/restore application state.
Specifically, you need to add a Preferences menu (you can use the Preferences framework presented in class), containing the following entries:
These entries should work as expected. You then need to restore these preferences.
You also need to save, as application state, these items (in addition to the preferences above):
We will use later databases for saving the entire history of the game, but for now, you can do the above using preferences.
If your HW2 was not running, then: try to get it to run... but if you can't, here is what you can do. Take the code for the Chapter 2 To-Do List, and add to it the following Preferences menu (as above, the preferences should be saved and restored when the application is closed/reopened):
You should also save, as application state, the content of the shopping list. The book tells you how to do it nicely with a database, but for this time, all you need to do is to somehow concatenate all the items into a single string, and save that using a key of your liking, e.g., "SHOPPING_LIST_CONTENT". To restore the state, you have to read the string, break it up into the shopping list items, and populate the shopping list. A clean way to turn a list into a string, and vice-versa, is to use Json, see the Java Json page. A less clean way would be to ... first remove all \, then use \ (or some other character) as separator. Yech. But as always, implement the simplest solution first, and once all works except for the transformation list -> string -> list, move to the Json solution (without losing your old code, in case you cannot make Json work).
Submit the .apk and .zip files on ecommons, as usual. In the text field, please write the approximate number of hours it took you to do the homework.