One of the ways to create the HandlerThread is to subclass it and most of the time you will be using this method.
Understanding Android Core: Looper, Handler, and HandlerThread
Janishar Ali
2K26

Hi!! great article. I was searching more about it and found this article with an example: https://blog.nikitaog.me/2014/10/11/android-looper-handler-handlerthread-i/

At the end the author explains why this may not be the best approach and I quote: “Sometimes it will work fine, but sometimes you’ll get NPE at the postTask call stating, that mWorkerHandler is null. You can be a victim of race conditions between two threads (main and background)”. What do you think?

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.