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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:30:47+00:00 2026-05-13T09:30:47+00:00

What I am trying to accomplish is to have clickable hyperlinks in the message

  • 0

What I am trying to accomplish is to have clickable hyperlinks in the message text displayed by an AlertDialog. While the AlertDialog implementation happily underlines and colors any hyperlinks (defined using <a href="..."> in the string resource passed to Builder.setMessage) supplied the links do not become clickable.

The code I am currently using looks like this:

new AlertDialog.Builder(MainActivity.this).setTitle(
        R.string.Title_About).setMessage(
        getResources().getText(R.string.about))
        .setPositiveButton(android.R.string.ok, null)
        .setIcon(R.drawable.icon).show();

I’d like to avoid using a WebView to just display a text snippet.

  • 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-13T09:30:47+00:00Added an answer on May 13, 2026 at 9:30 am

    If you are only showing some text and URL[s] in your dialog perhaps the solution is simpler

    public static class MyOtherAlertDialog {
    
     public static AlertDialog create(Context context) {
      final TextView message = new TextView(context);
      // i.e.: R.string.dialog_message =>
                // "Test this dialog following the link to dtmilano.blogspot.com"
      final SpannableString s = 
                   new SpannableString(context.getText(R.string.dialog_message));
      Linkify.addLinks(s, Linkify.WEB_URLS);
      message.setText(s);
      message.setMovementMethod(LinkMovementMethod.getInstance());
    
      return new AlertDialog.Builder(context)
       .setTitle(R.string.dialog_title)
       .setCancelable(true)
       .setIcon(android.R.drawable.ic_dialog_info)
       .setPositiveButton(R.string.dialog_action_dismiss, null)
       .setView(message)
       .create();
     }
    }
    

    As shown here
    http://picasaweb.google.com/lh/photo/up29wTQeK_zuz-LLvre9wQ?feat=directlink

    Alert dialog with clickable links

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

Sidebar

Related Questions

I am trying to accomplish the following: I have text file with following entries
I have a block of text shown like: What I am trying to accomplish
Which I'm trying to accomplish is have two classes, a non generic and a
What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate.
What I am trying to accomplish is the following: I have a Country box.
I'm trying to accomplish a simple thing. I have a 2 levels menu with
I am trying to accomplish the following: 1. On click, have a div with
That's pretty much what I am trying to accomplish. To have each image appear
I'm trying to figure out the best query to accomplish the following. I have
I am probably trying to accomplish too much in a single query, but have

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.