1

I am trying to set custom font in Android Studio..I have kept .ttf font file inside src-main-assets-fonts folder and i am typing this code in activity-

 Typeface avenirdemifont ;
avenirdemifont = Typeface.createFromAsset(this.getAssets(), "avenirdemifont.ttf");

            TextView textView = (TextView) findViewById(R.id.textView5);
            textView.setTypeface(avenirdemifont);

I am getting following error "native typeface cannot be made"

1 Answers1

0

It seems you forgot to add "fonts" directory to path. Try this:

 Typeface.createFromAsset(this.getAssets(), "fonts/avenirdemifont.ttf");
erakitin
  • 11,437
  • 5
  • 44
  • 49