Skip to content

Instantly share code, notes, and snippets.

@jeziellago
Created February 19, 2021 21:17
Show Gist options
  • Save jeziellago/a6fe3b5f461090b1e9df2ee53ceca930 to your computer and use it in GitHub Desktop.
Save jeziellago/a6fe3b5f461090b1e9df2ee53ceca930 to your computer and use it in GitHub Desktop.
class MyCustomThread : Thread() {
var handler: Handler? = null
override fun run() {
Looper.prepare()
handler = Handler(checkNotNull(Looper.myLooper())) { msg: Message ->
// do something with the received Message
true
}
Looper.loop()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment