code: @Override
      public void setSpan(Object what, int start, int end, int flags) {
          // Do not add any spans that affect the character appearance of a mention (i.e. they overlap
          // with a MentionSpan). This helps prevent mentions from having a red underline due to the spell
          // checker. Note: SuggestionSpan was added in ICS, and different keyboards may use other kinds
          // of spans (i.e. the Motorola SpellCheckerMarkupSpan). Therefore, we cannot just filter out
          // SuggestionSpans, but rather, any span that would change the appearance of our MentionSpans.
          if (what instanceof CharacterStyle) {
              MentionSpan[] mentionSpans = getSpans(start, end, MentionSpan.class);
              if (mentionSpans != null && mentionSpans.length > 0) {
                  return;
              }
          }
  
          // Ensure that the start and end points are set at zero initially
          // Note: This issue was seen on a Gingerbread device (start and end were both -1) and
          // prevents the device from crashing.
          if ((what == Selection.SELECTION_START || what == Selection.SELECTION_END) && length() == 0) {
              start = 0;
              end = 0;
          }
  
          super.setSpan(what, start, end, flags);
      }
docs: --------------------------------------------------