Object Oriented Programming: Android - Where’s My Car?
Essay by Olooool • October 11, 2015 • Essay • 545 Words (3 Pages) • 1,284 Views
Leo Roman Bitara BSCpE-IV Object Oriented Programming
Ai2 Tutorial – Chapter 7
Android, Where’s My Car?
[pic 1]
Components for the app.
[pic 2]
LocationSensor1 - Sense GPS info. This is the event handler that is triggered when the phone receives a new GPS reading. The Location Sensor does some additional work for you by calling Google Maps to get a street address corresponding to the GPS location.
CurrentAddressDataLabel - Display dynamic data: the current address. Place the new data into the label for the current address.
- Latitude and Longitude are parameters of the Location Changed event.
CurrentLatLabel - Display dynamic data. The current latitude. Place the latitude into the appropriate label.
CurrentLongLabel - Display dynamic data. The current longitude. Place the longitude into the appropriate label.
[pic 3]
RememberButton - Click to record the current location. Remember the reading for current location. When the user clicks the Remember Button, the most current location data should be placed into the labels for displaying the remembered data.
DirectionsButton - Click to show the map. Map the remembered place.
[pic 4]
Directions Button - You want the app to open Google Maps and then display the directions from the user’s current location to the remembered location where the car is parked.
Web Viewer - Component can display any web page, including Google Maps. You’ll call WebViewer. Go to URL to open the map, but you want to open a URL that will show directions from the current location to the remembered location.
(“http://maps.google.com/maps?saddr=”) - The fixed part of the URL, the source address. One way to show directions in Maps is with a URL of the following form. along with two URL parameters, saddr and daddr, which specify the source and destination locations for the directions.
[pic 5]
TinyDB1 - Copies the location data from the LocationSensor properties into the database.
As you might recall from No Texting While Driving, the Store Value function has two arguments, the tag and the value.
- Tag identifies the data that you want to store, and the
- Value is the actual data that you want saved — in this case, the Location Sensor data.
LocationSensor1 - Sense GPS info. This is the event handler that is triggered when the phone receives a new GPS reading. The Location Sensor does some additional work for you by calling Google Maps to get a street address corresponding to the GPS location.
- Latitude and Longitude are parameters of the Location Changed event.
[pic 6]
The IF Block - is used to determine if the DirectionsButton should be enabled. It should be if data was indeed retrieved from the database. The test used is to compare the Remembered Address Data Label to its default value, unknown. If it is not unknown, itmust have been replaced with some remembered address.
...
...