• Have Any Question?
  • contact@eitworld.com

Using HTML in Android

Sometimes you may need to use html tags to format your text in android. This may be useful from the view of simplicity. Formatting with HTML is much simple than java. Therefore, if you know how to use HTML tags in android, the formatting will be much easier.

Step 1- A class named ‘Html’ is used for the purpose. This is a class of package ‘android.text’. This class has a method ‘fromHtml’ which is used statically i.e. no object is needed for this.

This method returns a value of type ‘Spanned’. This is also a class of package ‘android.text’.

Spanned html= Html.fromHtml(String);

Step 2- Now this variable of class ‘Spanned’ can be used as a string is used.

Real Time Web Analytics