Code example for Spannable

Methods: getSpanEndgetSpanStartgetSpanslength

0
		assertEquals('\n', spannable.charAt(spannable.length() - 1));
	} 
	 
	public void testBoldString() { 
		Spannable spannable = (Spannable) bypass.markdownToSpannable("One **Two** Three");
		StyleSpan[] spans = spannable.getSpans(0, spannable.length(), StyleSpan.class);
		assertEquals(1, spans.length);
		assertEquals(Typeface.BOLD, spans[0].getStyle());
		assertEquals(4, spannable.getSpanStart(spans[0]));
		assertEquals(7, spannable.getSpanEnd(spans[0]));
	} 
	 
	public void testLinkString() { 
		Spannable spannable = (Spannable) bypass.markdownToSpannable("[Link](https://github.com/Uncodin/bypass)");
		URLSpan[] spans = spannable.getSpans(0, spannable.length(), URLSpan.class);
		assertEquals(1, spans.length);
		assertTrue(spannable.toString().contains("Link"));
		assertEquals("https://github.com/Uncodin/bypass", spans[0].getURL());
	} 
	 
Contextual code suggestions in your IDE  Get Codota for Java