code: private void copy(@IntRange(from = 0) int start, @IntRange(from = 0) int end) {
          MentionsEditable text = getMentionsText();
          SpannableStringBuilder copiedText = (SpannableStringBuilder) text.subSequence(start, end);
          MentionSpan[] spans = text.getSpans(start, end, MentionSpan.class);
          Intent intent = null;
          if (spans.length > 0) {
              // Save MentionSpan and it's start offset.
              intent = new Intent();
              intent.putExtra(KEY_MENTION_SPANS, spans);
              int[] spanStart = new int[spans.length];
              for (int i = 0; i < spans.length; i++) {
                  spanStart[i] = copiedText.getSpanStart(spans[i]);
              }
              intent.putExtra(KEY_MENTION_SPAN_STARTS, spanStart);
          }
          saveToClipboard(copiedText, intent);
      }
docs: Copy the text between start and end in clipboard.
  If no span is present, text is saved as plain text but if span is present
  save it in Clipboard using intent.