Skip to content

Instantly share code, notes, and snippets.

@af2905
Last active November 11, 2023 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save af2905/b9cd48a99a870936cfdb4ab9497d8640 to your computer and use it in GitHub Desktop.
Save af2905/b9cd48a99a870936cfdb4ab9497d8640 to your computer and use it in GitHub Desktop.
receive_data_coroutine_dispatcher_main
val scope = CoroutineScope(Dispatchers.Main)
scope.launch {
val (result: String, duration: Duration) = measureTimedValue { receiveData() }
Log.d("TAG", "$result after ${duration.toDouble(DurationUnit.MILLISECONDS)} ms.")
showToast(context = this@MainActivity, message = result)
}
Log.d("TAG", "onCreate completed")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment