I developed several codes using HandlerThread, but so far, it is to some extent difficult to grasp the meaning of the run()
method that exists in the Handlerthread
class when extended.
HandlerThread
class, when extended, some abstract methods are to be overridden. One of them is:
run()
Would you please clarify the usage of it in the HandlerThread
class?
HandlerThread
is a subclass of Thread
, and Thread
has a run()
method.
HandlerThread overrides that in order to do its work, because that's how Threads are implemented. Unfortunately, it doesn't replace the JavaDoc comment with its own, so the documentation is copied from the Thread
class, which results in confusing documentation here.
As far as how you should use it: you shouldn't. It's an implementation detail that is, unfortunately, public. You shouldn't override it or call it. Just get the Looper
and use that to post things to the HanderThread
.