I currently have a tapping game which utilises the on pause, stop and onresume methods when the user presses the home button, the timer is 'cancelled' and the time left saved as long and then in the onresume a new timer is created with the time remaining - fine, however now when the timer completes a full run and the user procedes to start a new activity i.e. leaderboard/settings etc.. and returns the onResume is fired again and a countdown with 1 second remaining begins again, is there a way of stopping it being fired when returning from a certain activity or similar?
below you'll see a bodge job i have tried in vain to use, very messy and in effective but im running out of ideas!
protected void onResume() {
super.onResume();
if (timeLeft < 1000) {
} else {
if (timeLeft <= 0) {
} else {
if (newActivityOpened == true) {
} else {
if (isTimerRunning == true) {
startCountDownTimer();
}
}
}
}
}
Excuse all the redundant if statements, i keep adding them hoping to make something click haha.