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()](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMMZrL_Dnih3RSPqMtOuzh8Gej_1Apbf3oxdiQ2UUbtnogPLrbUzlZ7d9FBlEP70kQJWKmJx50193F8UZ3KO_sD3VRmVss8ALQIWECFx_6_n5rXsRn4-1p7Kx2fyy-OTwqSUCTOYrD9G4Z/s400/AndroidHtmlTextView.png) |
Display HTML strings on TextView using android.text.Html.fromHtml() |
No comments:
Post a Comment