Apr 29, 2013

Display HTML strings on TextView using android.text.Html.fromHtml()

Example to Display HTML strings on TextView using android.text.Html.fromHtml():

package com.example.androidhtmltextview;

import android.os.Bundle;
import android.app.Activity;
import android.text.Html;
import android.widget.TextView;

public class MainActivity extends Activity {
 
 String htmlString = "<i>Welcome to<i> <b>Android Coding</b>";

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  
  TextView htmlTextView = new TextView(this);
  setContentView(htmlTextView);
  
  htmlTextView.setText(Html.fromHtml(htmlString));
  
 }

}



Display HTML strings on TextView using android.text.Html.fromHtml()
Display HTML strings on TextView using android.text.Html.fromHtml()


No comments:

Post a Comment

Infolinks In Text Ads