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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:22:14+00:00 2026-05-27T20:22:14+00:00

I have using android alert dialog builder to display the some user message(String) as

  • 0

I have using android alert dialog builder to display the some user message(String) as a pop up box to the user.

Now, My requirement is the message box should be able to support HTML format for this message. Including, there may be a URL/link returned in this user message. Selecting this link should put the current application in the background and popup the phone’s browser and take the user to URL that was in the link. Closing the browser would brings application back to the foreground.

How can I do this? Can i use the same alert dialog builder or any other choice available?

  • 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-27T20:22:15+00:00Added an answer on May 27, 2026 at 8:22 pm

    All the above answer will not remove html tag like , etc if the given string contains, I tried to remove all the tags, and this is work fine for me

    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
    builder.setTitle("Title");
    
    LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(LAYOUT_INFLATER_SERVICE);
    View layout = inflater.inflate(R.layout.custom_dialog, null);
    
    TextView text = (TextView) layout.findViewById(R.id.text);
    text.setMovementMethod(LinkMovementMethod.getInstance());
    text.setText(Html.fromHtml("<b>Hello World</b> This is a test of the URL <a href=http://www.example.com> Example</a><p><b>This text is bold</b></p><p><em>This text is emphasized</em></p><p><code>This is computer output</code></p><p>This is<sub> subscript</sub> and <sup>superscript</sup></p>";));
    builder.setView(layout);
    AlertDialog alert = builder.show();
    

    and the custom_dialog would be like;

    <TextView android:id="@+id/text"
              android:layout_width="wrap_content"
              android:layout_height="fill_parent"
              android:textColor="#FFF"
              />
    

    The above code will remove all the html tag and shows Example as Click able URL all others in the specified html formatting text.

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

Sidebar

Related Questions

In Android, I have some code to check whether the user has GPS switched
I have few doubts regarding transparent AlertDialog box in android.I have created the alert
I am new to Android Programming. I need to display a Pop-Up message in
I have been using C# for a while now, and going back to C++
I have been using Ruby for a while now and I find, for bigger
I have an Android application that displays a list of names using checkboxes. I
Hi I am working Android application development using titanium studio.I have developed small application.my
I am trying to set the android Theme.Light theme for my alert dialog, but
I have an EditText using android:inputType=textPostalAddress as the keyboard type. I would like it
I have a button created using android widgets. I want to set the font

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.