Code example for HandlerThread

Methods: getLooper, quit

0
     * Close the WorkHandler instance. Should be called when the 
     * WorkHandler is no longer needed. 
     */ 
    public void close() { 
        if (mHandler != null) {
            mHandlerThread.getLooper().quit();
            mHandlerThread.quit();
            mHandler = null;
        } 
    } 
 
    /** 
     * Cleanup if needed and log the fact the WorkHandler instance was 
     * not properly closed. 
     * 
     * @override 
     */ 
    @Override 
    protected void finalize() { 
        if (mHandler != null) {
            close();