Java tutorial
//package com.java2s; import android.content.Context; import android.graphics.Typeface; import android.support.annotation.Nullable; public class Main { public static Typeface getTypface(@Nullable String font_name, Context mContext) { if (font_name == null) return Typeface.DEFAULT; return Typeface.createFromAsset(mContext.getAssets(), "fonts/" + font_name); } }