December 2013
Beginner
416 pages
12h 45m
English
As you’ve seen, when the application is not running there is no need to have the timer display update, and when the timer activity is re-created you need to refresh the display to put it into the correct state.
To fix these issues you need to update the screen at the correct time.
1. When onStart is called and the timer is still running, start calling the run method of UpdateTimer again. Add this code to the onStart method:
if (timerRunning) { handler = new Handler(); updateTimer = new UpdateTimer(); handler.postDelayed(updateTimer, UPDATE_EVERY);}
2. When onStop is called, you no longer need to update the display. Add this code to the onStop method:
Read now
Unlock full access