Skip to main content


Showing posts from August, 2016

Using simple html in android

In an app, instead of using a textview, we can use a webview. Why? Because webview is better looking. And, more importantly, we can format the text easily - specifically for long, long text. And, yes, it has an automatic scroll controls.

Now how do we display a static text in a webview? 

String str="your text here";

But your string should also have html tags in them. The simplest tags are html and body. So surround your string with these.

String str="your text here";
String str = "<html><body>"+str+"</body>";

But if you are using for formatting the text, like bold, italic, different font etc. to be used for some parts of the text? How do you get that done? 

The straight forward solution is learn html and hand code all the B 's and slash B's etc. yourself. 

Of course, I am kidding. There are plenty of html editors available for aut…