Browse Tag

textview

Handle links in TextView by Activity

1. Link creation (don’t forget to change the package name):

        mTextView= (TextView) findViewById(R.id.init_terms_text);
        mTextView.setText(
                Html.fromHtml("By continuing you accept our " +
                        "<a href=\"net.your.packagename://terms\">terms</a> " +
                        " and " +
                        "<a href=\"net.your.packagename://privacy\">privacy policy</a> "));
        mTextView.setMovementMethod(LinkMovementMethod.getInstance());
        mTextView.setLinksClickable(true);

2. Add target Activity to AndroidManifest.xml (don’t forget to change the package name):
Keep Reading

Clickable links in TextView

An example how to set text and clickable links in TextView:

textViewLinks

TextView textView = (TextView) findViewById(R.id.init_terms_text);
textView.setText(
        Html.fromHtml("By continuing you accept our " +
                "<a href=\"http://www.terms.com\">terms</a> " +
                " and " +
                "<a href=\"http://www.privacypolicy.com\">privacy policy</a> "));
textView.setMovementMethod(LinkMovementMethod.getInstance());