Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8036427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:37:06+00:00 2026-06-05T02:37:06+00:00

I have a String in TextView and I want to Linkify a substring from

  • 0

I have a String in TextView and I want to Linkify a substring from that string. for example:

click here to know more.

I’m getting the string dynamically. So i have to search if it has click here and convert that to link .How can I linkify “click here”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:37:08+00:00Added an answer on June 5, 2026 at 2:37 am

    To find a pattern inside a text and replace it, use this:

    Pattern p = Pattern.compile("click here");
    Matcher m = p.matcher("for more info, click here");
    StringBuffer sb = new StringBuffer();
    boolean result = m.find();
    while(result) {
        m.appendReplacement(sb, "<a href=\"www.mywebsite.com\">click here</a>");
        result = m.find();
    }
    m.appendTail(sb);
    String strWithLink = sb.toString();
    
    yourTextView.setText(Html.fromHtml(strWithLink));
    yourTextView.setMovementMethod(LinkMovementMethod.getInstance())
    

    This code will search inside your string and replaces all “click here” with a link.

    And at the end, do NOT add android:autoLink=”web” to you XML resource (section TextView), otherwise A-tags are not rendered correctly and are not clickable any longer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asynctask that reads data from a device and then I want
I want to set my textview to have a string, then, after some seconds
I've made a simple Android music player. I want to have a TextView that
I want to retrieve data from sqlite. user can have more than 1 score
I have a TextView which I fill with text from a string resources in
I have a string which has delimiter in it. I want to know the
I have the following TextView in my XML layout file:- <TextView android:layout_width=fill_parent android:layout_height=wrap_content android:text=@string/autolink_test
I have a problem with that code setContentView(R.layout.game); TextView text = (TextView) findViewById(R.id.qwe_string); text.setText(Hello
I have string like 8.123.351 (Some text here) I have used the Regex /([0-9,]+(\.[0-9]{2,})+(\.[0-9]{2,})?)/
I have String url = http://@50stackoverflow.com/questions/@50724043/@50xyz.html I want to replace @50 to space without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.