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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:35:05+00:00 2026-06-01T04:35:05+00:00

How to set part of text to Bold when using AlertDialog ‘s setMessage() ?

  • 0

How to set part of text to Bold when using AlertDialog‘s setMessage()? Adding <b> and </b> to my String doesn’t work.

  • 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-01T04:35:07+00:00Added an answer on June 1, 2026 at 4:35 am

    You need to use Html.fromHtml() too. For example:

    AlertDialog.setMessage(Html.fromHtml("Hello "+"<b>"+"World"+"</b>"));
    

    Update:
    Looks like Html.fromHtml(String source) has been deprecated in the Latest Android Nougat version. Although deprecation doesn’t mean that you need to change your code now, but it’s a good practice to remove deprecated code from your app as soon as possible.
    The replacement is Html.fromHtml(String source, int flags). You just need to add an additional parameter mentioning a flag.

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
       AlertDialog.setMessage(Html.fromHtml("Hello "+"<b>"+"World"+"</b>", Html.FROM_HTML_MODE_LEGACY));
    } else {
       @Suppress("DEPRECATION")
       AlertDialog.setMessage(Html.fromHtml("Hello "+"<b>"+"World"+"</b>"));
    }
    

    For more details have a look at this answer.

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

Sidebar

Related Questions

can i set a part of the text in a jList bold? in some
how to set part of text of the textview to bold font on iPhone?
Consider the following declaration as part of SomeClass private Set<String> blah = new HashSet<String>();
I have a set of flags which are part of a huge text data
Is there a way to set part of the text of the textarea with
My XAML contains in part <TextBox Text=PROJECTED TextAlignment=Center FontSize=11 FontWeight=Bold Foreground=White Background=#FF3376B8 Opacity=0.65 />
I'm trying to generate a set of text fields for an array using Rails
I'm trying to set up part of a schema that's like a Sequence where
I am looking to set full trust for a single web part, is this
As part of a VBA program, I have to set the background colors of

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.