Created
October 19, 2021 20:23
-
-
Save ThomasGorisse/2353eba7ff3940378341731defbc4349 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
textView.lifecycleScope.launchWhenCreated { | |
while (isActive) { | |
view.text = "${System.currentTimeMillis()}" // Dispatchers.Main | |
withContext(Dispatchers.IO) { // Dispatchers.IO for waiting in background | |
delay(1000) // Wait 1 second | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment