Code example for Editable

Methods: removeSpan, replace

0
     */ 
    public void setText(String text) {
        assertNotIgnoringSelectionChanges(); 
        if (text == null) text = "";
        Editable buffer = mTextOwner.getText();
        buffer.removeSpan(mSuggested);
        // this will cause a handleTextChanged call 
        buffer.replace(0, text.length(), text);
    } 
 
    public void addUserTextChangeWatcher(TextChangeWatcher watcher) {
        mTextWatchers.add(watcher);
    } 
 
    private void handleTextChanged(Editable newText) {
        // When we make changes to the buffer from within this function, it results in recursive 
        // calls to beforeTextChanges(), afterTextChanged(). We want to ignore the changes we're 
        // making ourself: 
        if (mCurrentTextChange.isHandled()) return;
        mCurrentTextChange.setHandled();
        final int pos = mCurrentTextChange.mPos;