Skip to content Skip to sidebar Skip to footer

Android: Exception In Setting Custom Font

I have been striking my head with setting up custom fonts to text from code since one hour.I already deed this in my previous project and it worked! But I don't know for what reaso

Solution 1:

Where are the fonts place and are they referenced correctly?

example:

Typefacetf= Typeface.createFromAsset(getAssets(), "fonts/myfont.otf")

you must put fonts/myfont.otf in assets/fonts folder in your Eclipse.

see: "RuntimeException: native typeface cannot be made" when loading font

Solution 2:

Make sure that the font extension is all lower case. In other words it should not be

GOTHIC.TTF

but

GOTHIC.ttf

Also tryputting it in the fonts folder in assets and reference it using fonts/GOTHIC.TTF

Solution 3:

I don't know what exactly worked from all I tried for but I got it working! :)

All I tried was,closing eclipse and immulator.Re-opening the project,cleaning the same and then fixing other bug of my project resulted me the working one.

Thanks for all the help guys!!

Post a Comment for "Android: Exception In Setting Custom Font"