Code example for URLSpan

0
 
        if (where != len) {
            Href h = (Href) obj;
 
            if (h.mHref != null) {
                text.setSpan(new URLSpan(h.mHref), where, len, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            } 
        } 
    } 
 
    private static void endHeader(SpannableStringBuilder text) {
        int len = text.length();
        Object obj = getLast(text, Header.class);
 
        int where = text.getSpanStart(obj);
 
        text.removeSpan(obj);
 
        // Back off not to change only the text, not the blank line. 
        while (len > where && text.charAt(len - 1) == '\n') {
            len--;