Adding Markers for Run Start and Finish

Now that you have everything else in place, it is relatively trivial to add markers to the map that show the start and finish locations of the run. You can also add some text along with those markers that will show up in an info window when you touch them.

Add the code highlighted below to updateUI().

Listing 36.12  Start and end markers with info (RunMapFragment.java)

 ​ ​ ​ ​p​r​i​v​a​t​e​ ​v​o​i​d​ ​u​p​d​a​t​e​U​I​(​)​ ​{​ ​ ​ ​ ​ ​ ​ ​ ​i​f​ ​(​m​G​o​o​g​l​e​M​a​p​ ​=​=​ ​n​u​l​l​ ​|​|​ ​m​L​o​c​a​t​i​o​n​C​u​r​s​o​r​ ​=​=​ ​n​u​l​l​)​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​r​e​t​u​r​n​;​ ​ ​ ​ ​ ​ ​ ​ ​/​/​ ​S​e​t​ ​u​p​ ​a​n​ ​o​v​e​r​l​a​y​ ​o​n​ ​t​h​e​ ​m​a​p​ ​f​o​r​ ​t​h​i​s​ ​r​u​n​'​s​ ​l​o​c​a​t​i​o​n​s​ ​ ...

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.