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

  • Home
  • SEARCH
  • 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 6146141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:54:11+00:00 2026-05-23T18:54:11+00:00

I want to place a hyperlink on android app that I am developing. I

  • 0

I want to place a hyperlink on android app that I am developing.

I tried this:

main.xml

<TextView 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:text="@string/hyperlink"
android:id="@+id/hyperlink" 
android:autoLink="web"
>
</TextView>

The strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WebLink</string>
<string name="hyperlink">http://google.com</string>
</resources>

But the problem is, the link looks like this: http://google.com and I don’t want to show the actual url.

1) How to replace link by text like “Click Here to visit Google” and the text is linked with the website url ?

2) How to place email address (same question, how to replace it with text something like “Click Here to Email” and the text should be linked with email@domain.com)


I also tried this tutorial: http://coderzheaven.com/2011/05/10/textview-with-link-in-android/

But I am getting following error messages:

Description Resource    Path    Location    Type
http cannot be resolved to a variable   MyLink.java /MyLink/src/com/MyLink  line 21 Java Problem
Syntax error on token "" <br /> <a href="", ? expected after this token MyLink.java /MyLink/src/com/MyLink  line 21 Java Problem
Type mismatch: cannot convert from String to boolean    MyLink.java /MyLink/src/com/MyLink  line 20 Java Problem
  • 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-05-23T18:54:13+00:00Added an answer on May 23, 2026 at 6:54 pm

    Use the default Linkify class.

    Here is an Example and the code from the tutorial:

    This is my sample code for you, I think this will solve your problem:

        public class StackOverflowActivity extends Activity {
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            // 1) How to replace link by text like "Click Here to visit Google" and
            // the text is linked with the website url ?
            TextView link = (TextView) findViewById(R.id.textView1);
            String linkText = "Visit the <a href='http://stackoverflow.com'>StackOverflow</a> web page.";
            link.setText(Html.fromHtml(linkText));
            link.setMovementMethod(LinkMovementMethod.getInstance());
            // 2) How to place email address
            TextView email = (TextView) findViewById(R.id.textView2);
            String emailText = "Send email: <a href=\"mailto:person@stackoverflow.com\">Click Me!</a>";
            email.setText(Html.fromHtml(emailText));
            email.setMovementMethod(LinkMovementMethod.getInstance());
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to place a Webpart on a page that holds a subfolder of
I want to place this UserControl at Canvas.Left=168, Canvas.Top=213. However, the control appears at
I want to place a custom webpart on the main page of my sharepoint
I have a dialog that I want to place within another dialog and position
I have the following values that I want to place into a mysql db
I want to place this div at the bottom of the screen, and it
I want to place development web.xml in another folder in eclipse.
I want to place a skype call automatically and I tried different ways: first
i want to place the thumb of the seek bar in android at extreme
I want to place one div over the other. I've already accomplished this with

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.