O'Reilly logo

Android Programming: The Big Nerd Ranch Guide by Brian Hardy, Bill Phillips

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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​ ​+​ ​"​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required