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());

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.