Back to project page android-movies-demo.
The source code is released under:
MIT License
If you think the Android project android-movies-demo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.idunnolol.moviesdemo.util; //www . j a va 2s .c om import android.content.Context; import android.graphics.Typeface; import java.util.HashMap; import java.util.Map; public class FontCache { private static Map<String, Typeface> sCachedFonts = new HashMap<String, Typeface>(); public static Typeface getTypeface(Context context, String assetPath) { if (!sCachedFonts.containsKey(assetPath)) { Typeface tf = Typeface.createFromAsset(context.getAssets(), assetPath); sCachedFonts.put(assetPath, tf); } return sCachedFonts.get(assetPath); } }