Using custom fonts on Android

The default fonts you can choose from when developing for Android are not very interesting. Normally they are OK for my simple purposes, but for once I wanted something a little bit prettier for my new app, Happy Moments.

I found this tutorial very useful for using custom fonts on Android:

http://mobile.tutsplus.com/tutorials/android/customize-android-fonts/

And I found some pretty nice fonts on this site suitable for the concept of my app:

http://www.fontsquirrel.com/fonts/list/category/Handwritten

Here’s the gist:

Step 1: Find a nice font and put it in your assets/ folder

Step 2: Set the custom font in code (which is the only way to do it), like this:

TextView message = (TextView) findViewById(R.id.message); 
Typeface font = Typeface.createFromAsset(getAssets(), "Chantelli_Antiqua.ttf");
message.setTypeface(font);

And voila, the result in the app itself: