Code example for StyleSpan

0
            append(new String(baseText.data, 0, baseText.sizeCopied));
            append(' ');
            append(new String(highlightedText.data, 0, highlightedText.sizeCopied));
            setSpan(new StyleSpan(Typeface.ITALIC), 0, baseText.sizeCopied, 0);
            setSpan(new StyleSpan(Typeface.ITALIC), baseText.sizeCopied + 1,
                    baseText.sizeCopied + 1 + highlightedText.sizeCopied, 0);
        } 
    } 
 
    @Override 
    public TextWithHighlighting createTextWithHighlighting() { 
        return new TestTextWithHighlighting(); 
    } 
}