Blog Entry #18
April 9, 2016
I made more updates to the project site, and I also researched further into using JSON. After looking into my options, I have decided to store the information in a JSON database. While it doesn't have the cleanliness that a CSV or XLSX file has, what it does have is built-in Android Studio and PHP support, something that Excel does not have. After this, I then made the decision to reach out and grab the data from my Project site, and then process the data and show it within the app. Once again, this was for time and keeping things simple.
After creating a test file within a new directory on my Project site, I decided that my first objective was without trying to do any filtering, get the app to reach out to the project site, get the JSON file, and print it back out on the screen. After some tinkering around all day, I finally got the app to print out my test database.
The next thing I attempted to do was to see if I could send the search parameters from main on to the Result activity. At first, I had a problem with getting the integers to transfer. The strings did get passed correctly, without any issues. I discoverd quickly that the reason the ints weren't passing correctly was because I was incorrectly passing them. After fixing my error, everything passed as it should.
The last major thing I am focusing on before moving on to the formatting of the search results page is to ensure filtering works correctly. Currently, I have the activity accessing the external JSON database in a background thread, and this is due to the fact that Android does not support doing so in a foreground thread. The first thing I set about to do was to correctly parse the JSON data, since I had not done so already. As was previously stated, Android supports the ability to do this, so I imported JSON libraries to properly separate the data out. After applying proper JSON translating, I used a for loop to check if each item fell into my filter options. If no filter options were listed, then all items are displayed. After some testing, I have confirmed that the search is operating the way that it should. Below are a few test cases I performed: