Skip to content

Instantly share code, notes, and snippets.

@af2905
Last active November 11, 2023 19:48
Show Gist options
  • Save af2905/6269bde77fe97653b56d49d30342aee4 to your computer and use it in GitHub Desktop.
Save af2905/6269bde77fe97653b56d49d30342aee4 to your computer and use it in GitHub Desktop.
receive_data_on_background_thread
val thread = Thread {
val (result: String, duration: Duration) = measureTimedValue { receiveData() }
Log.d("TAG", "$result after ${duration.toDouble(DurationUnit.MILLISECONDS)} ms.")
showToast(context = this, message = result)
}
thread.start()
Log.d("TAG", "onCreate completed")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment