Create a simple LooperThread

suggest change

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() {
        Looper.prepare();

        mHandler = new Handler() {
            public void handleMessage(Message msg) {
                // process incoming messages here
            }
        };

        Looper.loop();
    }
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents