html code is in a string saved, example:
Text1 = texttexttext <img src="test.png" /> texttexttext
i use
content.SetText (Html.FromHtml (Text1), TextView.BufferType.Spannable);
to load the html and it works fine.
now i want to include also images in html/textview, so i added the imagegetter
i found this examples:
`public class ImageGetter:Java.Lang.Object, Html.IImageGetter { public Drawable GetDrawable(string source) { int id; if (source.Equals("test.png")) { id = Resource.Drawable.Icon; } else { return null; }
Drawable d = GetDrawable (id);
d.SetBounds(0,0,d.IntrinsicWidth, d.IntrinsicHeight));
return d;
}
}
`
or
`public class NewsImageGetter:Java.Lang.Object, Html.IImageGetter { public Drawable GetDrawable(string source) { Drawable drawable; Bitmap bitMap; BitmapFactory.Options bitMapOption; try { bitMapOption = new BitmapFactory.Options(); bitMapOption.InJustDecodeBounds = false; bitMapOption.InPreferredConfig = Bitmap.Config.Argb4444; bitMapOption.InPurgeable = true; bitMapOption.InInputShareable = true; var url = new Java.Net.URL(source);
bitMap = BitmapFactory.DecodeStream(url.OpenStream(),null,bitMapOption);
drawable = new BitmapDrawable(bitMap);
}
catch (Exception)
{
return null;
}
drawable.SetBounds(0, 0,bitMapOption.OutWidth, bitMapOption.OutHeight);
return drawable;
}
public new IntPtr Handle
{
get { return base.Handle; }
}
public new void Dispose()
{
base.Dispose();
}
} `
i also changed the Set Text to:
content.SetText (Html.FromHtml (Text1, new ImageGetter(), null), TextView.BufferType.Spannable);
but it doesnt work, please help!