Homework 6: Persistent Storage on Android
To Deliver: Release 10.0
To Download:
Due date for submission: Nov 26, at 5 AM
Drop out date: Dec 4, at 5 AM
Motivation
Persistent storage is one of the essentials one needs to figure out for each programming language and architecture.
In this homework you are tasked to extend your AMaze user interface with some functionality to load and store data in various ways.
To motivate these features, we look into the settings of preferences and usage / performance statistics for your AMaze app plus the
ability to load precalculated mazes. The ability to load some precalculated mazes from files may be interesting to provide benchmark or challenge problems for users but it also helps us develop the maze app itself as we can test functionality on particular mazes that are well known to us.
The goal of this homework is to get more experience in Java file i/o on an Android architecture.
You find corresponding documentation in Murphy's book "The Busy Coder's Guide to Android Development", Version 5.2, Chapter "Assets, Files, and Data Parsing" (pages 401 ff).
Requirements
Extend the AMaze UI to provide longterm usage statistics.
Extend the AMaze UI to
- load a maze from an internal, read-only resource file that comes with the apk
- load and store mazes in internal files that allow for read and write access.
To do list:
- USAGE STATISTICS
- At the finish screen, add some further usage statistics.
- How often has the game been played successfully at this level of difficulty?
- What was the shortest path ever found at this level of difficulty?
- What was the lowest energy consumption ever observed at this level of difficulty?
- Load and store usage statistics in preferences with respect to
- the number of times the game has been played successfully at each level of difficulty
- the shortest path ever found at each level of difficulty
- the lowest energy consumption ever observed at each level of difficulty
- Of course this data is updated after each successful game.
- STORED, PRECALCULATED MAZES IN RESOURCE FILES
- If you have not done this yet, produce mazes for skill level 0 to 4 in your Java application and store them in files named maze0.xml, maze1.xml, …, maze4.xml.
- Copy those files into your Android AMaze project. You can use the assets directory or the res directory for resources. In the latter you could use res/raw or res/xml in individual files (one per maze), see http://developer.android.com/guide/topics/resources/providing-resources.html for the use of individual subdirectories in the resources directory. Note that the use of the values directory comes with constraints implies that it is not good to use here.
- Use the graphic feature on the title screen from Project 5 that allows a user to select "load maze from file" such that when the start button is clicked and the skill level is in the range 0,..,4 then the corresponding maze is loaded from file in the generating phase.
- STORED MAZES IN INTERNAL FILES
- Use the graphic feature on the title screen from Project 5 that allows a user to select "load maze from file" such that when the start button is clicked and the skill level is greater than 4 then
- if this is the first time, then use the generating phase to generate a random maze, store it on an internal file and let the user play the maze.
- if this is in the situation and a corresponding maze already exists, then use the generating phase to load that maze from file and let the user play this maze again.
- Update your Java maze project in your svn repository.
- Produce a tag release 10.0
Grading:
You will receive points
- if your app successfully maintain usage statistics
- if your app successfully loads precalculated mazes from files for skill levels 0,1,…,4.
- if your app successfully produces and stores mazes for skill levels greater than 4.