Displaying a Run’s Path

Your next task is to show the user a line that follows his or her run. The Maps API makes this trivial, but you need to fetch the list of locations so you know how to build the line. Add a method to both RunDatabaseHelper and RunManager to provide a LocationCursor with this data.

Listing 36.7  Querying a run’s locations (RunDatabaseHelper.java)

 ​ ​ ​ ​p​u​b​l​i​c​ ​L​o​c​a​t​i​o​n​C​u​r​s​o​r​ ​q​u​e​r​y​L​o​c​a​t​i​o​n​s​F​o​r​R​u​n​(​l​o​n​g​ ​r​u​n​I​d​)​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​C​u​r​s​o​r​ ​w​r​a​p​p​e​d​ ​=​ ​g​e​t​R​e​a​d​a​b​l​e​D​a​t​a​b​a​s​e​(​)​.​q​u​e​r​y​(​T​A​B​L​E​_​L​O​C​A​T​I​O​N​,​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​n​u​l​l​,​
 ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​C​O​L​U​M​N​_​L​O​C​A​T​I​O​N​_​R​U​N​_​I​D​ ​+​ ​"​ ...

Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.