currently practicing making an application using android studio. I have this customized font and saved into res/font directory for the later use. Inside the activity, i am trying to call getfont(R.font.my_customized_font) with the typeface object. ex) Typeface font = getResources().getfont(R.font.mycustomizedfont)
However, when i try to run the project with the actual device which has the API level 24, it won't activate since the getfont() method requires the min sdk level with 26.
I know that you can set the font of text view in the xml file by doing android:fontfamily but i am using the textswitcher instead of textview.
Emulator works fine by setting up min sdk with 26 but I would like to figure this out by using the actual device.
I found the solution by reading through the developer's website I just added Typeface font = ResourcesCompat.getfont(context, R.font.mycustomizedfont)