“RuntimeException: native typeface cannot be made” when loading font

Android does not support OpenType (OTF), only TrueType (TTF), so your Molot.otf font probably will not work. I wrote both of those blog posts you link to in your opening sentence (the one is a pirated copy of the other), and they do not use Molot.otf. (BTW, I somewhat repaired the formatting of that post … Read more

How do I specify eg. Roboto-Medium or Roboto-Black in styles.xml

On Android 5.0 you can set Roboto Medium with sans-serif-medium. This solution, taken from Google iosched 2014, uses sans-serif on Android pre-v21: values/styles.xml <style name=”MyStyle”> <item name=”android:fontFamily”>@string/font_fontFamily_medium</item> </style> values/fonts.xml <string name=”font_fontFamily_medium”>sans-serif</string> values-v21/fonts.xml <string name=”font_fontFamily_medium”>sans-serif-medium</string>

How to add external fonts to android application

You need to create fonts folder under assets folder in your project and put your TTF into it. Then in your Activity onCreate() TextView myTextView=(TextView)findViewById(R.id.textBox); Typeface typeFace=Typeface.createFromAsset(getAssets(),”fonts/mytruetypefont.ttf”); myTextView.setTypeface(typeFace); Please note that not all TTF will work. While I was experimenting, it worked just for a subset (on Windows the ones whose name is written in … Read more

How set Spannable object font with custom font

This is a late answer but will help others to solve the issue. Use the following code:(I’m using Bangla and Tamil font) TextView txt = (TextView) findViewById(R.id.custom_fonts); txt.setTextSize(30); Typeface font = Typeface.createFromAsset(getAssets(), “Akshar.ttf”); Typeface font2 = Typeface.createFromAsset(getAssets(), “bangla.ttf”); SpannableStringBuilder SS = new SpannableStringBuilder(“আমারநல்வரவு”); SS.setSpan (new CustomTypefaceSpan(“”, font2), 0, 4,Spanned.SPAN_EXCLUSIVE_INCLUSIVE); SS.setSpan (new CustomTypefaceSpan(“”, font), 4, 11,Spanned.SPAN_EXCLUSIVE_INCLUSIVE); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)