Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MainActivity : AppCompatActivity() {
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_main)
- button.setOnClickListener {
- GlobalScope.launch(context = Dispatchers.Main) {
- println("launched coroutine 1")
- delay(5000)
- println("Here after a delay of 5 seconds")
- }
- GlobalScope.launch(context = Dispatchers.Main) {
- println("launched coroutine 2")
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment