I am developing one application, where I need to use .woff fonts. I have written the following code to get font type face from .woff file and set into textview.
hellofont = getFont("fonts/AvenirLTStd-Black.woff");
//welcomefont = getFont ( "fonts/AvenirLTStd-Heavy.woff");
thankufont = getFont("fonts/RobotoCondensed-Bold.ttf");
TextView text1 = (TextView) findViewById(R.id.text1id);
text1.setTypeface(hellofont);
TextView text2 = (TextView) findViewById(R.id.text2id);
text2.setTypeface(thankufont);
public Typeface getFont( String fontName){
try {
Typeface content = Typeface.createFromAsset(this.getAssets(), fontName);
return content;
}
catch(RuntimeException e)
{
Toast.makeText(this,e.getMessage(),Toast.LENGTH_LONG).show();
}
return null;
}
This code works fine on android 5.0 and 6.0 devices. But it is giving exception ( Font asset not found fonts/AvenirLTStd-Black.woff )on android 7.0 devices. I have tested ttf and otf fonts on android 7.0 devices and it is working fine. Only woff fonts gives this exception.
I have attached the screen shot also which shows the fonts in assests/fonts folder. asset folder with woff fonts
Can anyone help me" what is the issue here?
Thanks in advance Krishna