December 2013
Beginner
416 pages
12h 45m
English
As you may have noticed, the On Your Bike app currently has a small design flaw: Once the timer is started, it keeps running. If you switch activities, the current value of the timer will be stored most of the time but not always. The timer continues to run, but sometimes it’s reset to zero—and that does not provide the best user experience. Let’s correct that.
1. Open the TimerActivity class, and review what happens when you start a timer and then go to another activity. You can do this by setting break points in the lifecycle methods such as onCreate, onStart, onStop, and onRestart or by looking at the logged messages in the LogCat view.
2. Run the application in a device, and you’ll see that the application’s ...
Read now
Unlock full access