I see a lot examples in code were we see the next thing:
HandlerThread thread = new HandlerThread("Thread1");
thread.start();
mLoadHandler = new Handler(thread.getLooper())
mLoadHandler.post(new Runnable() {
public void run() {
// run some code
//methodA();
}
});
you can find it also in:
Why they create a HandlerThread
for only one purpose: to pass it's Looper
to a new Handler
. Why don't just extend the HandlerThread
and do the all code (methodA()
) there? OR create a Handler instance and call there to:
Looper.prepare();
Looper.loop();