How to set part of text to Bold when using AlertDialog‘s setMessage()? Adding <b> and </b> to my String doesn’t work.
How to set part of text to Bold when using AlertDialog ‘s setMessage() ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You need to use
Html.fromHtml()too. For example: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.For more details have a look at this answer.