Code example for HandlerThread

Methods: quit

0
                mSocket.shutdownInput();
            } catch (IOException e) {
                Log.w(TAG, "I/O error during listener shutdown", e);
            } 
        } 
        mWriteThread.quit();
    } 
 
    public void sendUsbModeSwitchCmd(final String cmd) {
        if (cmd != null) {
            Log.d(TAG, "received usb mode change command from UI: " + cmd);
            mWriteHandler.post(new Runnable() {
                @Override 
                public void run() { 
                    writeCommand(cmd, null);
                } 
            }); 
        } 
    } 
}