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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:20:40+00:00 2026-06-10T02:20:40+00:00

Following my previous question I still have problems managing hyperlinks on my custom AlertDialog

  • 0

Following my previous question I still have problems managing hyperlinks on my custom AlertDialog but I believe I narrowed down the problem because I think it only not works because it’s a custom dialog.

I have followed all the instructions here and here but can’t seem to bypass this situation

On strings.xml I have a string defined this way:

<string name="link_text_manual"><b>text2:</b> This is some other
  text, with a <a href="http://www.google.com">link</a> specified
  via an &lt;a&gt; tag.  Use a \"tel:\" URL
  to <a href="tel:4155551212">dial a phone number</a>.
</string>

If I create my dialog this way:

AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Data")
        .setIcon(R.drawable.info)
       .setMessage(R.string.link_text_manual)
       .setCancelable(true)
       .setNegativeButton("OK", new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int id) {
                dialog.dismiss();
           }
       });

AlertDialog welcomeAlert = builder.create();
welcomeAlert.show();
// Make the textview clickable. Must be called after show()
((TextView)welcomeAlert.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());

it shows like this:

Image 1

This works as expected and all clicks are clickable.

Now I want the same thing but on a custom layout.

Created a TextView on my info.xml like this:

<TextView
    android:id="@+id/infoDetailText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_below="@+id/infoVersionTitle"
    android:autoLink="all"
    android:linksClickable="true"
    android:padding="4dp" />

And this is the code:

    Context ctx = this;
    LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.info, (ViewGroup) findViewById(R.id.infoLayout));

    AlertDialog.Builder about = new AlertDialog.Builder(ctx);
    about.setView(layout);
    about.setTitle("Data");
    about.setIcon(R.drawable.info);

    AlertDialog displayInfo = about.create();
    displayInfo.show();
    // Make the textview clickable. Must be called after show()
    TextView textView = (TextView) displayInfo.findViewById(R.id.infoDetailText);
    textView.setText(R.string.link_text_manual);
    textView.setMovementMethod(LinkMovementMethod.getInstance());

With the above code it shows like this (links not clickable and even not marked as links):

Image 2

If I remove

    textView.setMovementMethod(LinkMovementMethod.getInstance());

it shows like the bellow image (Links marked as links but not clickable):

Image 3

I’ve also tried to use Linkify and android:autoLink="web" but the result is always the same.

setMessage() works but with a custom layout with a TextView can’t make it to work.

Probably this is simple but can’t seem to make it work. Any suggestions?

Thanks

  • 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-10T02:20:42+00:00Added an answer on June 10, 2026 at 2:20 am

    You defined the TextView without android:autoLink="all" , android:clickable="true" & android:linksClickable="false"

    For info.xml TextView as below

    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/infoDetailText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="4dp" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Related to my previous question , I have a string on the following format:
This problem follows on from a previous question . When I run the following
I have a problem following from my previous problem . I also have the
Following on from my previous question , I have now managed to rotate my
From a previous question , I have the following: So I have implemented a
Following my previous question , I need to create a value consisting of a
Following on from my previous question: Simple inner join in linq How would I
Following up from my previous question , why is CShell so different from C?
Following on from a previous question, for some reason when I use the following
Following on from a previous question relating to heap usage restrictions , I'm looking

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.