I am working on applying a custom font on TextView from a library and font file is stored in res/font of the app folder.
I got the typeface by using
int id = context.getResources.getIdentifier("xxx","font",packageName);
Typeface typeface = context.getResources.getFont(id);
Typeface is not null, I have put debug points and verified.
TypefaceSpan span = new TypefaceSpan(typeface);
Now I want to create TypefaceSpan object from this typeface and I am getting below error and application crashes.
java.lang.NoSuchMethodError: No direct method (Landroid/graphics/Typeface;)V in class Landroid/text/style/TypefaceSpan; or its super classes (declaration of 'android.text.style.TypefaceSpan' appears in /system/framework/framework.jar!classes2.dex).
Please help. Thanks in advance.