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

Updating the UI with Location Data

Just to verify that things are working as expected, add click listeners to the Start and Stop buttons in RunFragment that communicate with RunManager. Also add calls to a simple updateUI() method.

Listing 33.7  Starting and stopping location updates (RunFragment.java)

p​u​b​l​i​c​ ​c​l​a​s​s​ ​R​u​n​F​r​a​g​m​e​n​t​ ​e​x​t​e​n​d​s​ ​F​r​a​g​m​e​n​t​ ​{​

 ​ ​ ​ ​p​r​i​v​a​t​e​ ​R​u​n​M​a​n​a​g​e​r​ ​m​R​u​n​M​a​n​a​g​e​r​;​ ​ ​ ​ ​p​r​i​v​a​t​e​ ​B​u​t​t​o​n​ ​m​S​t​a​r​t​B​u​t​t​o​n​,​ ​m​S​t​o​p​B​u​t​t​o​n​;​ ​ ​ ​ ​p​r​i​v​a​t​e​ ​T​e​x​t​V​i​e​w​ ​m​S​t​a​r​t​e​d​T​e​x​t​V​i​e​w​,​ ​m​L​a​t​i​t​u​d​e​T​e​x​t​V​i​e​w​,​ ​ ​ ​ ​ ​ ​ ​ ​m​L​o​n​g​i​t​u​d​e​T​e​x​t​V​i​e​w​,​ ​m​A​l​t​i​t​u​d​e​T​e​x​t​V​i​e​w​,​ ...

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