Code example for SpannableStringBuilder

Methods: insert

0
    private int cursorPos() { 
        return cursorPos(mString);
    } 
 
    private void insertAtCursor(String text) {
        mString.insert(cursorPos(), text);
        checkInvariant(); 
    } 
 
    private void insertAtCursor(char ch) {
        insertAtCursor(Character.toString(ch));
    } 
 
    private void insertAt2ndCursor(String text) {
        m2ndString.insert(cursorPos(m2ndString), text);
        check2ndInvariant(); 
    } 
 
    private void insertAt2ndCursor(char ch) {
        insertAt2ndCursor(Character.toString(ch));
    } 
 
    private void deleteBeforeCursor(int count) {
        int pos = cursorPos();
        count = Math.min(pos, count);
        mString.delete(pos - count, pos);
        checkInvariant(); 
    } 
 
    private void replaceSelection(String withThis) {
        mString.replace(Selection.getSelectionStart(mString),
                Selection.getSelectionEnd(mString), withThis);
        checkInvariant(); 
    } 
 
    private void setSuggested(String suggested) {
        mController.setSuggestedText(suggested);
        checkInvariant(); 
    } 
 
    private void set2ndSuggested(String suggested) {
        m2ndController.setSuggestedText(suggested);
        check2ndInvariant(); 
    } 
 
    private void checkInvariant() { 
        mController.checkInvariant(mString);
    } 
 
    private void check2ndInvariant() { 
        m2ndController.checkInvariant(m2ndString);
    }