问题
I decided to use Downloadable fonts in my project. I implemented everything as recommened in the guide.
The following problem occured, when i tried to get font from ResourcesCompat next way:
ResourcesCompat.getFont(MainActivity.this, R.font.roboto_bold)
After that, i always get this exeption:
Font resource ID #0x7f090005 could not be retrieved
How to solve this problem?
PS:
- support-compat library v27
- min sdk 16
- solution via ResourcesCompat.FontCallback is not a good way in my case
- problem occurs on devices with and without Google Play Services
回答1:
Quote from https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts.html#via-android-studio:
You can set your application to download fonts by using Android Studio 3.0. To help you get started with the Downloadable Fonts features, you can use the font provider from Google Play services.
Note: A device must have Google Play services version 11 or higher to use the Google Fonts provider.
来源:https://stackoverflow.com/questions/48815918/downloadable-fonts-exception