Android examples for User Interface:TextView
Linkify any links appearing in the text and place it in the TextView.
//package com.java2s; import android.content.Context; import android.text.SpannableString; import android.text.method.LinkMovementMethod; import android.text.util.Linkify; import android.widget.TextView; public class Main { /**//www . ja v a 2 s.co m * Linkify any links appearing in the text and place it in the text view. */ public static void linkifyTextView(Context ctx, TextView textView, int stringResId) { SpannableString s = new SpannableString(ctx.getText(stringResId)); Linkify.addLinks(s, Linkify.WEB_URLS); textView.setText(s); textView.setMovementMethod(LinkMovementMethod.getInstance()); } }