Code example for Editable

Methods: replacesetSelectionremoveSpansetSpanlength

0
            } 
        } 
 
        // allText is at this point either "userText" (not null) or 
        // "suggested" if thats not null and starts with userText. 
        text.replace(0, text.length(), allText);
        Selection.setSelection(text, selStart, selEnd);
        mUserEntered.replace(0, mUserEntered.length(), userText);
        mSuggestedText = suggested;
        if (suggestedStart < text.length()) {
            text.setSpan(mSuggested, suggestedStart, text.length(),
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        } else { 
            text.removeSpan(mSuggested);
        } 
        text.setSpan(mBufferSpanWatcher, 0, text.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
        mTextOwner.addTextChangedListener(mBufferTextWatcher);
        if (DBG) checkInvariant(text);
    } 
 
    private void assertNotIgnoringSelectionChanges() {