How to set custom font for alert dialog in android?

3
=
1
+
2
3 Bitcoin bounty has been announced by author.
1 has been already awarded by author.
2 remains available.
2

In my android application an alert dialog appear after clicking on a button. I want to set custom font for that. I searched and found some tutorials and questions link this. but none of them didn't work for me. can every one help me out. Thanks.

User rating:

Thank you

User rating:
User rating:
User rating:

2 answers

2
=
1
=
$2
1 tip with total amount of 8.9 mBTC($2 USD) have been sent by alex

To do this you use alert builder to build your alert. You then get the TextView from this alert and then you set the typeface for the alert.

AlertDialog dialog = new AlertDialog.Builder(this).setMessage("Hello world").show();
TextView textView = (TextView) dialog.findViewById(android.R.id.message);
Typeface face=Typeface.createFromAsset(getAssets(),"fonts/FONT"); 
textView.setTypeface(face); 
SEND BITCOIN TIPS
User rating:

Thank you, here are some coins

0

Read this blog, it helped me.

SEND BITCOIN TIPS
0

Too many commands? Learning new syntax?

FavScripts.com is a free tool to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.

Boost your productivity with FavScripts.com!

Post Answer