1

I want use my font in project and write this code in android studio:

Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/behzadd.ttf");
        text.setTypeface(tf);
        text.setText("بهزاد");

i copy my behzadd.ttf font file in this path:

res/fonts/behzadd.ttf


but when i run the project i get this error:

 Caused by: java.lang.RuntimeException: native typeface cannot be made
            at android.graphics.Typeface.<init>(Typeface.java:147)


how can i solve that?

behzad razzaqi
  • 1,503
  • 2
  • 18
  • 33

1 Answers1

1

Put your font in the assets folder , so the path is : assets/fonts/behzadd.ttf

Fouad Wahabi
  • 804
  • 7
  • 16