Olivier
11/15/2018, 9:52 AMval timer = Timer().also {
it.scheduleAtFixedRate(0, 1000) {
val hours = seconds / 3600
val minutes = (seconds % 3600) / 60
val secs = (seconds % 60)
timeView.text = String.format(Locale.getDefault(), "%d:%02d:%02d", hours, minutes, secs)
seconds++
}
}
And to stop instead (instead of using a weird boolean):
timer.cancel()