Code example for SpannableStringBuilder

Methods: getSpans, length

0
 
        checkSmileys((SpannableStringBuilder) messageStyler.getHistory());
    } 
 
    private void checkColor(final SpannableStringBuilder builder) {
        final ForegroundColorSpan[] spans = builder.getSpans(0, builder.length(), ForegroundColorSpan.class);
 
        assertNotNull(spans);
        assertEquals(1, spans.length);
        assertEquals(50, spans[0].getForegroundColor());
    } 
 
    private void checkLinks(final SpannableStringBuilder builder) {
        final URLSpan[] spans = builder.getSpans(0, builder.length(), URLSpan.class);
 
        assertNotNull(spans);
        assertEquals(1, spans.length);
        assertEquals("http://kouchat.googlecode.com/", spans[0].getURL());
    } 
 
    private void checkSmileys(final SpannableStringBuilder builder) {