get TypeFace - Android Graphics

Android examples for Graphics:Font

Description

get TypeFace

Demo Code


//package com.java2s;
import android.content.Context;
import android.graphics.Typeface;

public class Main {
    /**/*from   ww w.j  ava  2 s.c om*/
     *
     * @param fromAsset
     * @param context
     * @return
     */
    public static Typeface getTypeFace(Typeface fromAsset, Context context) {

        if (fromAsset == null) {

            fromAsset = Typeface.createFromAsset(context.getAssets(),
                    "font/RobotoCondensed-Regular.ttf");
        }

        return fromAsset;
    }
}

Related Tutorials