Kostadin
Kostadin

Reputation: 2549

android linkfy for part of textview

I'm using Textview to show text with URLs inside. How to linkfy part of text? This tag doesn't work:

<a href=\"http://www.mycite.com/terms/android\"><big>current terms</big></a>

Upvotes: 0

Views: 288

Answers (2)

Sunny
Sunny

Reputation: 14808

TextView tv = (TextView) findViewById(R.id.text3);
    tv.setText(
        Html.fromHtml(
            "<b>text3:</b>  Text with a " +
            "<a href=\"http://www.google.com\">link</a> " +
            "created in the Java source code using HTML."));
    tv.setMovementMethod(LinkMovementMethod.getInstance());

Upvotes: 0

Samir Mangroliya
Samir Mangroliya

Reputation: 40416

tv.setMovementMethod(LinkMovementMethod.getInstance());
tv.setText(Html.fromHtml(Your string));

Upvotes: 2

Related Questions