I'm developing an app that needs to support multiple languages, including some for which fonts are not included in some older Android versions.
The same TextView can have content in multiple languages, so setting a single TypeFace does not help, I need to have a list of fall-back fonts to use when some characters are not available in preferred fonts.
Extending to this, I also need to use the same set of fonts for other elements also (not only TextViews) if possible.
I had a workaround for this. I extended the Application class for the app and set the fonts globally there.
For the fallback fonts, I read the Android API code for Typeface
and going from there, I found some hidden APIs. Doing all sorts of hacking (reflections, getting private/hidden classes or methods, setting private fields etc.), I finally made it working for Android API versions 21 to 23. Not sure about the newer APIs and it doesn't work for the older ones.
You can check my code at https://gist.github.com/nisargjhaveri/47acc83e66dcb347e05685ccfd3038e8
It is working, but even I don't recommend using it!
The better solution for this may be to use TypefaceSpans, after detecting the best typeface for each character, everytime you show text to user. I did not try this.
Also, I just have been playing with android for past two months, so think twice before you take my advice! :P