Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.widget.TextView;

public class Main {
    private static final String TAG = "MainUtils";

    public static void buildLink(TextView view, String url) {
        Log.d(TAG, "buildLink(view = " + view + ", url = " + url + ")");

        StringBuilder sb = new StringBuilder();
        sb.append("<a href='").append(url).append("'>").append(view.getText()).append("</a>");
        view.setText(Html.fromHtml(sb.toString()));
        view.setMovementMethod(LinkMovementMethod.getInstance());
    }
}