Linkify in android TextView

10,130

Solution 1

I had problems with automatic links, so I turned it off and instead I am using html formating of the text plus this code:

TextView textView = (TextView) findViewById(R.id.TextBox);
textView.setMovementMethod(LinkMovementMethod.getInstance());
textView.setText(Html.fromHtml(strText));

An email link goes <a href="mailto:[email protected]">[email protected]</a>

Solution 2

 android:autoLink="web"
Share:
10,130
Rashmi.B
Author by

Rashmi.B

Updated on June 04, 2022

Comments

  • Rashmi.B
    Rashmi.B almost 2 years

    I have a text view with text" This is a product developed by XYZ. For more queries, mail us at [email protected]. And I have linkified "[email protected]". But the problem is, whenever I touch any area below the textview, it gets linked to the email. How Do I make sure, the link has to happen only on clicking [email protected] used patterns, Linkify.EMAIL_ADDRESS..nothing seem to work...kindly suggest some answers