Skip to content

Instantly share code, notes, and snippets.

@jeziellago
Created February 19, 2021 21:21
Show Gist options
  • Save jeziellago/006b0a3171f4aaf430a0ac13b7fd318f to your computer and use it in GitHub Desktop.
Save jeziellago/006b0a3171f4aaf430a0ac13b7fd318f to your computer and use it in GitHub Desktop.
val mainHandler = Handler(Looper.getMainLooper()) { msg ->
// do something with msg
// Main Thread here!!
true
}
val imageThread = ImageFileThread(mainHandler) {
val message = Message().apply {
data = bundleOf(
"image_url" to "https://example.com/img.png"
)
}
sendMessage(message)
}
// start the thread
imageThread.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment