I have created a TextView library project where I have used a custom font. I have to create this library because this TextView
will use in other three project as well. I found that assets/fonts folder is not supported by android library project. If I use this way it gives me error message
native typeface cannot be made at android.graphics.Typeface
Is there any workaround here to solve this issue. Other way, I have to use duplicate view in three different app. And also the sample code I am using to get font from library assets folder.
public static Typeface getFont(Context c, String fontName) {
synchronized (fonts) {
if (!fonts.containsKey(fontName)) {
Typeface t = Typeface.createFromAsset(
c.getAssets(), "fonts" + File.separator + fontName);
fonts.put(fontName, t);
}
return fonts.get(fontName);
}
}