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 8158705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:41:44+00:00 2026-06-06T17:41:44+00:00

I’ve been trying to figure this one out for a bit using patterns or

  • 0

I’ve been trying to figure this one out for a bit using patterns or other utils but haven’t gotten it to work just yet.

Say I have an HTML link:

 <a href="http://www.google.com">Google, Inc.</a>

I want to make a link into a text view BUT set the text of the link as the actual URL not Google, Inc.

So for example if the data I received is:

–Hey if you want to try a search go to <a href="http://www.google.com">Google, Inc.</a> and it’s easy as that.

I want it to display as:

–Hey if you want to try a search go to http://www.google.com and it’s easy as that.

Instead of:

–Hey if you want to try a search go to Google, Inc. and it’s easy as that.

Html.fromHtml() makes it show as “Google, Inc.” automatically, but isn’t the result that I want.

Also, I don’t need this to work for specifically this example, I need it to work for all html links as I don’t know what links I will get as data.

  • 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-06T17:41:47+00:00Added an answer on June 6, 2026 at 5:41 pm

    I suggest using Linkify and parsing the Strings yourself to create the links you want.

    Set Linkify to look for raw web addresses and turn them into links in your text:

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:autoLink="web"
        />
    

    This function will pull the raw address out the html tags:

    public String parseLinks(String raw) {
        String openTag = "<a href=\"";
        String closeTag = "</a>";
        String result = "";
    
        int start = 0;
        int middle = raw.indexOf(openTag);
        int end;
        while(middle > -1) {
            result += raw.substring(start, middle);
    
            end = raw.indexOf("\">", middle);
            result += raw.substring(middle + openTag.length(), end);
    
            start = raw.indexOf(closeTag, end) + closeTag.length(); 
            middle = raw.indexOf(openTag, start);
        }
    
        result += raw.substring(start, raw.length());
        return result;
    }
    

    Understand that this function does no error checking, I recommend adding this yourself.

    Now simply pass the String returned from parseLinks() to your TextView, like this:

    textView.setText(parseLinks(rawHTML));
    

    Hope that helps!

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.