Android Project

D&D Character
Database App

For this project I was tasked with creating a simple android application that had an embedded database file containing Dungeons & Dragons character data. (Character names, classes, races, and attribute points) One fragment needed to contain a list populated by character names from the table, while a second fragment loads all the data of a specific character once you click on that character. I also needed to then add code for a second version of the app that adds a "last accessed" column which is updated and displayed live in the app.

Here is the first fragment where you can see the list of character names from the database. Adding, deleting, or editing character records beyond adding the last accessed column was beyond the scope of this assignment. So, the only option users have is to click on a name to display the rest of the data belonging to that character.

This is the second fragment where the full data records of the character selected from the first fragment is displayed. This image also shows the last accessed data from the second version of this application.

On larger devices, like this emulated android tablet, both fragments are displayed at the same time. The list stays visible on the left portion of the screen while the large right portion displays the most recently selected character data and will update live as the user selects other characters to view.

For this assignment I needed the version that included the last accessed column to be able to take in the older version of the database file from the previous version of the assignment and update it to add the last accessed column if the provided table did not have one. In this code snippet I wrote a method hasDates() that returns a boolean value depending on if a last accessed column is found after querying the database. The return value can then be used to run the addDateCol() method that alters the table only if the column was missing.

With this screenshot you can see the structure and content of the database file when examined in DB Browser.

And here you can see the updated database from the second version of the application where you can see how a default value is added for each record's last accessed column which is then updated with an actual time once it has been accessed in the actual application.