Example to display HTML String with link on TextView:
package com.example.androidhtmltextview;
import android.os.Bundle;
import android.app.Activity;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
public class MainActivity extends Activity {
String htmlString = "<i>Welcome to<i> <b><a href='http://lesapplication.blogspot.com'>Android Coding</a></b>";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView htmlTextView = new TextView(this);
setContentView(htmlTextView);
htmlTextView.setText(Html.fromHtml(htmlString));
htmlTextView.setMovementMethod(LinkMovementMethod.getInstance());
}
}
|
Display HTML String with link on TextView |
0 Response to "Display HTML String with link on TextView"
Posting Komentar