Advertisement
senosebastian

Timer Corutine

Mar 30th, 2020
518
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.33 KB | None | 0 0
  1.  fun startTimer() {
  2.         val tickerMode = ticker(delayMillis = 600, initialDelayMillis = 0)
  3.         launch {
  4.             var count = 5
  5.             for (event in tickerMode) {
  6.                 count--
  7.                     showCountdown.value = count
  8.                 if (count == 0) tickerMode.cancel()
  9.  
  10.             }
  11.         }
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement