I think I'm too late to answer Roberta’s question, but I’m sure that many other guys are still struggling with this problem, I was one of them.
In any case, the easiest way to find this: In strings.xml, add your HTML code inside CDATA , and then in the process of getting the string and loading it into the WebView , here is an example:
in strings.xml:
<string name="st1"><![CDATA[<p>This is <a href="http://www.test.hu">a test link</a> and this is a sample text with special char: éva </p>]]> </string>
you can replace é with amac; (note: between and amacute and ; ) there is no space
Now in your activity, create a WebView and load the string st1 into it:
WebView mWebview = (WebView)findViewById(R.id.*WebViewControlID*); mWebview.loadDataWithBaseURL(null, getString(R.string.st1), "text/html", "utf-8", null);
And horraaa, it should work correctly. If you find this post helpful, I will be grateful if you can mark it as an answer, so we help others struggling with this problem.
m.othman
source share