Starting from:
$30

$24

Lab 5 Tide Table with a List View Solution

Objectives: This lab is designed to give you practice:




Developing a UI that uses a ListView



Using a SimpleAdapter to load data into a ListView
Parsing an XML file



Part 1: Do the textbook exercises shown below:




10-1, Review the News Reader app



10-2, (Optional) Work with asynchronous tasks (apply this in a future lab)
10-3, (Optional) Modify the News Reader app (none of our lab projects use RSS feeds)



Upload a text file to Canvas in which you will report, for each exercise above, whether you:




Followed all the steps shown in the book and successfully compiled and ran the program (where applicable).
Loaded the completed solution, experimented with the code, and ran the program (where applicable).
Read through the steps and inspected the relevant code without writing or running a program.
Didn’t do any of the above.
Part 2: For this lab assignment you will create an app that displays tide predictions for a coastal location. You will need to download an annual tide prediction file for a US coastal location from the NOAA web site: http://tidesandcurrents.noaa.gov/tide_predictions.html.




For example, you could download the annual tide predictions for the Florence, OR USCG station:

http://tidesandcurrents.noaa.gov/noaatidepredictions/NOAATidesFacade.jsp?Stationid=9434098.




Display the tide table using an activity with a ListView (or an activity derived from ListActivity). The list should show the date and time for each high and low tide (usually 4 per day). It should have:

A TwoLineListItem layout.



Either one of these adapters:

An adapter derived from BaseAdapter. The list adapter should use a list or array of custom objects (instances of a class you define that holds tide predictions).



A SimpleAdapter



When you click on a row, it should show the height of the tide in either inches or cm using a toast.
Optional: Fast scrolling and a section index. The section index should show the month.



Format your ListView as shown in the example below:




Example




List View:




2015/12/31 Monday




High: 02:56 AM

2015/12/31 Monday

Low: 08:30 AM

2015/12/31 Monday

High: 02:02 PM

2015/12/31 Monday

Low: 08:59 PM

2016/01/01 Tuesday <-- Click here for toast




High: 03:29 AM

2016/01/01 Tuesday

Low: 09:13 AM

2016/01/01 Tuesday

High: 02:44 PM

2016/01/01 Tuesday

Low: 09:33 PM




--------------------------------




Toast:




6.1 ft., 186 cm




Zip your project folder and upload it to Canvas.

More products