Use an External Font

To use an external font you have to create a folder in asset directory .  Here I create a folder fonts in assets directory.


Now in your Activity/Fragment, you can use those fonts like below. For my case, i am in fragment.

 public class GeneralFragment extends Fragment {  
   
      TextView textViewGeneralDescription;  
   
      // Set Font path  
      String fontPath = "fonts/RobotoCondensed-Regular.ttf";  
   
      @Override  
      public View onCreateView(LayoutInflater inflater, ViewGroup container,  
                Bundle savedInstanceState) {  
   
           View rootView = inflater.inflate(R.layout.generalfragment, container,  
                     false);  
   
           textViewGeneralDescription = (TextView) rootView  
                     .findViewById(R.id.generalDescription);  
   
           // Loading Font Face  
           Typeface tf = Typeface.createFromAsset(getActivity().getAssets(),  
                     fontPath);  
             
           // Applying font  
           textViewGeneralDescription.setTypeface(tf);  
             
           return rootView;  
      }  
 }