Comp Sci Project Showcase
by Cody Schober

Blog Entry #25

April 25, 2016


I have begun to put my bookmarks feature into action. The first thing I did was create a local JSON database in the resources folder of the android app. This way, if a user adds the app to their phone, their bookmarks will be local and tied to the app itself. Not only that, using JSON allows me to separate and maintain the information for the bookmarks as I desire, with the name of the project and the url to that project. With this, I have implemented the first part, being to call the internal JSON database and extract it. I am doing this only in the main activity, since that is the first activity that loads, and the same navigation drawer will be used across different sites.

Ultimately, my game plan will be to use Android Studios' built-in functionality to append new bookmarks to the resources file. To give users the option to add a bookmark, there will be a fab icon that they can press to add it. When it is added, I will dynamically add the menu item to the navigation drawer, and I will append the new JSON item to the internal database.

So far, I am able to dynamically add menu items to the navigation drawer. However, the items in the drawer are lost when switching over to another activity. After some further research, I discovered the reason why this isn't working is that I am incorrectly calling the "same" navigation drawer in multiple activities. What is happening is that the navigation drawer is being duplicated in each activity, and had thus looked the same before. I am in the process of figuring out how to make it so that one, single navigation drawer is shared across multiple activities. The primary method I am looking into right now is storing the navigation drawer in a fragment.