Set text in Bold in AlertDialog
android, android-alertdialog
Solution
This page describes how to add HTML formatting to resource strings.
Their example seems to help if you are having trouble with formatting strings:
Store your styled text resource as an HTML-escaped string:
<resources>
<string name="welcome_messages">Hello, %1$s! You have <b>%2$d new messages</b>.</string>
</resources>
In this formatted string, a element is added. Notice that the opening bracket is HTML-escaped, using the < notation.
Problem
I want to make a part of message text in Bold in AlertDialog. I tried: adding `<b> </b> tag` in `strings.xml` but nothing positive. i have also used `Html.fromHtml("<b>"+getString(R.string.ittformulanote)+"</b>")` i have also been to stackoverflow.com but no positive result. Below my Code: ``` showDialog(getActivity(),"Sample",Html.fromHtml("<b>"+getString(R.string.ittformulanote)+"</b>")+"\n\n"+)); public static void showDialog(Context mContext, String Title, String Description) { final AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); dialog.setTitle(Title); // dialog.setMessage((Html.fromHtml("<b>"+Description+"</b>"))); dialog.setMessage(Description); dialog.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); // TODO Auto-generated method stub } }); // AlertDialog alert=dialog.create(); // dialog.show(); alert.show(); } ```