So i have this in Strings.xml:
<string name="sixpackInfo">
<html><body><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. </p>
<p><b>Sed dignissim lacinia nunc. Curabitur tortor.</b> Pellentesque nibh. Aenean quam. In sce
</body></html>
</string>
I try to load and parse this string into a webview.
like so:
wvInformation = (WebView) findViewById(R.id.wvInformation);
String text = getResources().getString(R.string.sixpackInfo);
System.out.println(text);
wvInformation.loadData(text, "text/html", null);
i am getting the lorem ipsum text into the webview but the p tags and b tags arent taken care of. the text just appear as plain text with the markup.
<string name="sixpackInfo">
<![CDATA[<html><body><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. </p>
<p><b>Sed dignissim lacinia nunc. Curabitur tortor.</b> Pellentesque nibh. Aenean quam. In sce
</body></html>
]]>
</string>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With