Code example for ExtractedText

0
            ExtractedText et = new ExtractedText();
            if (mEditable == null) {
                et.text = "";
            } else { 
                et.text = mEditable.toString();
                et.partialEndOffset = mEditable.length();
                et.selectionStart = Selection.getSelectionStart(mEditable);
                et.selectionEnd = Selection.getSelectionEnd(mEditable);
            } 
            et.flags = mSingleLine ? ExtractedText.FLAG_SINGLE_LINE : 0;
            return et;
        } 
 
        @Override 
        public boolean deleteSurroundingText(int leftLength, int rightLength) {
            if (!super.deleteSurroundingText(leftLength, rightLength)) {
                return false; 
            } 
            shouldUpdateImeSelection = true;
            return mImeAdapter.deleteSurroundingText(leftLength, rightLength);
        }