is it possible to parse a string with html tags (like br,  , the accented letters, ..) without parsing the image tag ? If yes , how can i do It?
3 Answers
Depends on what you are going to do with that parsed string. If you need to display it in a TextView, then you could use
textView.setText(Html.fromHtml(yourString, customImageGetter, null));
Where customImageGetter is your subclass of Html.ImageGetter which returns empty drawables in getDrawable(String source) method. Empty drawable could be an 1x1 transparent image.
Comments
Define the html string in strings.xml and use this
<string name="about">
<![CDATA[
<html>
<head></head>
<body style="text-align:justify;">
</body>
</html>
]]>
tv.setText(Html.fromHtml(getString(R.string.about)));
2 Comments
Francesco Stranieri
it's for messages, like chat, so i can't have a strings.xml about it
Karthik
check out this sample from google developer.android.com/samples/TextLinkify/index.html
I guess this would work.
1. Initially, in the html tags instead of using <img> </img>, you will have to use <image> </image>
strTemp ="<h2>Title</h2><br><p>Description here</p> <image src='source here'></image>";
2.
Spanned sp = Html.fromHtml( strTemp );
3.
textView.setText(sp.toString().replace("image", "img"));