Code example for SpannableStringBuilder

Methods: append, setSpan

0
	@Override 
	public void handleTagNode(TagNode node, SpannableStringBuilder builder,
			int start, int end) {
		String src = node.getAttributeByName("src");
 
		builder.append("\uFFFC");
 
		Bitmap bitmap = loadBitmap(src);
 
		if (bitmap != null) {
			Drawable drawable = new BitmapDrawable(bitmap);
			drawable.setBounds(0, 0, bitmap.getWidth() - 1,
					bitmap.getHeight() - 1);
			builder.setSpan(new ImageSpan(drawable), start, end,
					Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
		} 
	} 
 
	/** 
	 * Loads a Bitmap from the given url. 
	 *