You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
synchronized (CountUpTimer.this) {
long elapsedTime;
elapsedTime = SystemClock.elapsedRealtime() - base;
// If elapsed paused time is not zero, reset them to zero so as to begin tracking
// any further instances of pause button being tapped on
if(elapsedPausedTime != 0L){
elapsedPausedTime = 0L;
pauseStart = 0L;
pauseEnd = 0L;
}
// If condition set up to hinder onTick callBacks being sent if
// elapsedTime somehow is more than the duration.
// Stop the timer if it has run for the required duration.
if(elapsedTime >= duration) {
stop();
} else {
onTick(elapsedTime);
sendMessageDelayed(obtainMessage(MSG), interval);
}
}
}
};
The text was updated successfully, but these errors were encountered:
https://www.androiddesignpatterns.com/2013/01/inner-class-handler-memory-leak.html
Refer - countUpTimer.java: Line 87
The text was updated successfully, but these errors were encountered: