2024-05-01から1ヶ月間の記事一覧

Async Await

This is my note for Udemy lesson: Advanced Android Bootcamp 2024. Assume we have these two function, private suspend fun getStock1(): Int { delay(1000) return 2 } private suspend fun getStock2(): Int { delay(2000) return 3 } and we want to…

Switch Thread of Coroutine

This is my note for Udemy lesson: Advanced Android Bootcamp 2024. CoroutineScope(Dispatchers.IO).launch { // heavy tasks withContext(Dispatchers.Main) { // UI changes } }

Set up Coroutine

This is my note for Udemy lesson: Advanced Android Bootcamp 2024. 1. Import Coroutine Latest version can be found here. In app's build.gradle, add the dependencies: dependencies { implementation "org.jetbrains.kotlinx:kotlinx-coroutines-co…