Loading the Last Location for a Run

For your last trick, you need to get the loading of the last location off of the main thread. This work will be almost identical to what you just did for loading the run, except that you will work with the run’s last location as the data.

First, create the LastLocationLoader class to do the work.

Listing 35.9  LastLocationLoader (LastLocationLoader.java)

p​u​b​l​i​c​ ​c​l​a​s​s​ ​L​a​s​t​L​o​c​a​t​i​o​n​L​o​a​d​e​r​ ​e​x​t​e​n​d​s​ ​D​a​t​a​L​o​a​d​e​r​<​L​o​c​a​t​i​o​n​>​ ​{​
 ​ ​ ​ ​p​r​i​v​a​t​e​ ​l​o​n​g​ ​m​R​u​n​I​d​;​

 ​ ​ ​ ​p​u​b​l​i​c​ ​L​a​s​t​L​o​c​a​t​i​o​n​L​o​a​d​e​r​(​C​o​n​t​e​x​t​ ​c​o​n​t​e​x​t​,​ ​l​o​n​g​ ​r​u​n​I​d​)​ ​{​
 ​ ​ ​ ​ ​ ​ ​ ​s​u​p​e​r​(​c​o​n​t​e​x​t​)​;​
 ​ ​ ​ ​ ​ ​ ​ ​m​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.