Code example for Handler

Methods: removeMessagessendEmptyMessageDelayed

0
        } 
        return s;
    } 
 
    public void saveLater() { 
        mHandler.removeMessages(SAVE_MESSAGE);
        mHandler.sendEmptyMessageDelayed(SAVE_MESSAGE, SAVE_DELAY);
    } 
 
    public void save() { 
        synchronized (mGestures) {
            try { 
                BufferedWriter w = new BufferedWriter(new FileWriter(mLogfile, /*append=*/ true));
                w.append(toJsonLocked() + "\n");
                w.close();
                mGestures.clear();
                // If we have a pending gesture, push it back 
                if (mCurrentGesture != null && !mCurrentGesture.isComplete()) {
                    mGestures.add(mCurrentGesture);
                } 
                if (DEBUG) {