You cannot get getAssets()
from a fragment directly. You have to use getActivity().getAssets()
instead of using only getAssets()
.
Use this
Typeface font = Typeface.createFromAsset(getActivity().getAssets(), "fonts/Delius-Regular.ttf");
instead of
Typeface font = Typeface.createFromAsset(getAssets(), "fonts/Delius-Regular.ttf");
Read more about Set custom font for Android fragments