Tutorial by Examples

A typical example of the implementation of a Looper thread given by the official documentation uses Looper.prepare() and Looper.loop() and associates a Handler with the loop between these calls. class LooperThread extends Thread { public Handler mHandler; public void run() { Lo...
A HandlerThread can be used to start a thread with a Looper. This looper then can be used to create a Handler for communications with it. HandlerThread thread = new HandlerThread("thread-name"); thread.start(); Handler handler = new Handler(thread.getLooper());

Page 1 of 1