Adapter that will join views and other adapters

Quite common situation you have ListView and you need to add something different to it like header or footer layouts – this helps a lot:

Picking contacts from device

First answer:

SimpleAdapter and Spanned from Html.fromHtml

In TextView which is part of ListView and SimpleAdapter the HTML tags are stripped, the solution is to add ViewBinder:

adapter.setViewBinder(new SimpleAdapter.ViewBinder() {
	public boolean setViewValue(View view, Object data, String textRepresentation) {
		if (data instanceof Spanned && view instanceof TextView) {
			((TextView) view).setText((Spanned) data);
		} else {
			((TextView) view).setText(String.valueOf(data));
		return true;

Copyright © All Rights Reserved · Green Hope Theme by Sivan & schiy · Proudly powered by WordPress