Last active
September 8, 2021 12:18
-
-
Save droid-it/206ce1a39496d83fc4a731b639e93b5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable | |
fun TimerScreen() { | |
val scope = rememberCoroutineScope() | |
Column { | |
Button(onClick = { | |
println("Timer started") | |
scope.launch { | |
try { | |
startTimer(5000) { | |
println("Timer ended") | |
} | |
} catch (ex: Exception) { | |
println("Timer cancelled") | |
} | |
} | |
}) { | |
Text("Start Timer") | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment