For this assignment I created a GeoCacheBuddy app. It takes a lot of the user interface out of my UandI app, but has quite a few differences. The MainActivity holds a ListView populated with Caches that have been stored in a Database. It also has EditTexts on the bottom for adding new Cache’s. Simply enter the coordinates and click the “Add Cache” Button. This will insert a row for the new cache into the Database and update the ListView with a new cache ID. (Note: I disabled orientation changes as I could not place a ListView in a ScrollView to prevent ‘losing’ items).
To open a Cache click on the item in the ListView (must click the text, couldn’t figure out why clicking anywhere in the row didn’t work), this sends you over to the CacheActivity where it queries the database for the cache coordinates and displays them in the EditTexts on top. These coordinates can be altered and automatically saved if either EditText changes focus or a button is pressed (except the delete button), but will not do so if either of them are blank as that would cause problems. This activity also has buttons for “Update Calculations” and “Delete Cache”. The Update Calculations button gets your current coordinates from the phone’s GPS and displays them in TextViews. It also calculates a compass bearing to the cache and displays it. These items are safe for screen orientation changes, and the entire activity is in a ScrollView so nothing is ‘lost’. The “Delete Cache” button removes the cache’s row from the database and sends the user back to the MainActivity. (Note: The app will die horribly if you remove all the caches from the database….so don’t do that)
This app could use a little polish before I would want the general public to use it, but it is usable as is.