Tag Archives: application development

My first Native Android App (Update #2)

I’m very close to calling this app, version 1.0. 🙂 Since the last update, I’ve tweaked a few things about the Android application. For starters, I stepped back to think about the potential users of my app and streamlined the ‘home’ screen into 2 core functions:

A. Browse restaurant inspection results by county.

  • This defaults to Clarke county but you can select a different county to view
  • After hitting the button, the user will be presented with simple listing of all the restaurants in that county.
  • I added SectionIndexer to this listing to help the user navigate faster. This blog post was very helpful in understanding this feature and getting it to work.

Screenshot_2013-10-28-18-35-54Screenshot_2013-10-28-18-36-01Screenshot_2013-10-29-00-13-58device-2013-10-29-004634

B. Find a specific restaurant’s scores by searching.

  • This is an AutoCompleteTextView which hopefully guides the user in their search
  • The user has to enter a search term with at least 2 characters. I tried searching “a” and it wasn’t pretty. 🙂
  • After hitting the button, the user will be presented with a map with the locations represented by markers and  a ListView of the found restaurants. It also implements the SectionIndexer.
  • A concern I had with this page was the fact that initially, I was calling out to Google Maps API in the same thread as my user interface and Google recommends against doing this. For queries like “uga” or “mc” which return a large number of restaurants, it took the resultant activity a while to load to I investigated AsyncTask. I’m happy to say I got it working and I owe a ton of thanks to Stackoverflow.com without which I would not have come this far in my app. 😀

Screenshot_2013-10-28-18-36-13Screenshot_2013-10-28-18-58-35device-2013-10-29-004856

After performing either A or B, the user can select a restaurant to view health inspection details and the user will see any of the following screens:

Screenshot_2013-10-28-19-00-27Screenshot_2013-10-28-19-00-37Screenshot_2013-10-28-19-03-12Screenshot_2013-10-29-00-29-50

Sidebar: I scraped the health inspection data from the Public Health Athens website and I used the wonderful Jsoup library to do it. I’m hoping to clean up my code and publish it on Github for others to check out and maybe use.  <digression>I’m currently using git (Bitbucket) for version control and I love Bitbucket because of their unlimited free private repos! Github does offer 5 free private repos to students but I use version control on my school projects and as you can imagine, I have way more than 5 private repos on Bitbucket.</digression>

Because of the way I scraped/collected the data, my application (should) only display the recent health inspection data, etc. It doesn’t retain any historical information but that is out of my hands due to the limited information available on the website. A case could be made for instances where the site shows 2 different scores but scraping depends on regularity and I found several instances where the site didn’t stick to expected format. I digress;  I’ll deal with that issue later.

From what I was able to glean from the site, here’s how the colors work:

  1. if you have a score of 90 or higher without any critical violations, you are in the green. You could have a few non-critical violations here.
  2. Any critical violations lands you in the red zone even with a score above 90.
  3. If you are above 80 and only have non-critical violations, you get a yellow check mark.

If any violations are present, there’ll be a button for you to click through to see the corresponding violations associated with that restaurant. For instance:

Screenshot_2013-10-29-00-31-27 Screenshot_2013-10-29-00-31-02

So there you have it: my first native Android app in the works. I’m feeling pretty good about my app’s progress and I’m currently seeking a few beta testers. If you live in the Athens, GA area and have an Android phone with version 2.3 or higher, feel free to send me a note about wanting to be a beta tester. My gmail handle is janeullah so shoot me an email if interested. The impetus for getting this app off the ground was the fact that I’m working on another Android app with 3 of my classmates for a class (Human Computer Interaction (HCI) with Dr. Chris Plaue).

Helpful Tools

  1. Stackoverflow is every CS student’s not-so-secret weapon. I’m not ashamed to say this was my first port of call whenever I had problems. Thanks to Stackoverflow, I resolved every issue I had. From how to create the proper calls to the SQLite database, getting the SQLiteDatabase to be copied to the right location using the right conventions, properly setting up my Async Task, to creating custom ListView adapters, et cetera. So, even if the first question doesn’t have an answer, try a different search term and really try to understand the answers that were provided. From now on, I’ll do my part by documenting solutions to issues I’ve faced either here or on Stackoverflow.
  2. On Android, the data’s stored in a SQLiteDatabase which I created by using the mysql2sqlite.sh script to convert my MySQL database to SQLite. For version 2, I’ll probably make the home screen a little nicer (less bare) and include a “restaurants around me” type of activity.
  3. After converting the MySQL database to a SQLiteDatabase file, I had to edit the SQLiteDatabase directly and I did this with the help of a Firefox addon called SQLite Manager.

Screenshot from 2013-10-29 00:53:30

Advertisements