Created
March 19, 2016 18:32
-
-
Save abbas-oveissi/2c8193cc562292d4fb84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FontHelper { | |
private static final Map<String, Typeface> TYPEFACES = new HashMap<>(); | |
public static Typeface get(Context context,String fontFileName){ | |
Typeface typeface = TYPEFACES.get(fontFileName); | |
if(typeface == null){ | |
typeface = Typeface.createFromAsset(context.getResources().getAssets(), fontFileName); | |
TYPEFACES.put(fontFileName, typeface); | |
} | |
return typeface; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment