free web tracker
Course Content
Java Programming Basics for Android
Learn the basics of Java programming for Android app development using Android Studio. This guide covers key concepts like variables, loops, and classes to help you start building your first Android apps with confidence. Perfect for beginners!
0/10
User Interaction and App Logic
Learn how to make your app respond to users! This section covers handling clicks, getting input, showing messages, switching screens, and saving simple data. A perfect start to build interactive Android apps with real logic.
0/10
Advanced Layouts and Components
Learn to build modern Android UIs using advanced layouts like RecyclerView, CardView, TabLayout, and more. This section helps beginners create beautiful, interactive, and user-friendly app interfaces step by step.
0/10
Media and Resources
Learn how to manage media and resources in Android Studio. This section covers adding audio, images, video, using drawables, custom fonts, and handling runtime permissions—essential for building rich, engaging Android applications.
0/4
Mastering Java Android Development – Beginner

Custom fonts can help make your Android app stand out by giving it a unique style. In this guide, you’ll learn how to add and apply custom fonts in a Java-based Android app using Android Studio.

Step 1: Add Your Font File

    1. Prepare your font file (e.g., myfont.ttf or myfont.otf).
    2. Create a fonts folder inside the res directory:
        • Right-click res → New → Android Resource Directory.
        • Select “Resource type: font” and click OK.
        • Copy your font into the newly created res/font folder.

      •  

  1.  

  1.  

Step 2: Apply Font in XML

If you’re using Android API 26 or higher:

    <TextView
        android:id="@+id/myTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:fontFamily="@font/kingrimba"
        android:padding="24dp"
        android:text="Hello Custom Font"
        android:textSize="30sp" />

Replace myfont (ex. kingrimba, https://www.dafont.com/king-rimba.font)with the actual name of your font file (without the extension).

Step 3: Apply Font in Java Code

If you want to apply the font programmatically.

Place the font file in the assets/fonts folder:

        • Create the folders assets → fonts (if not exist).
        • Put myfont.ttf (ex Brunson, https://www.dafont.com/brunson.font) in assets/fonts.

        • Apply the font to your TextView:

 TextView myText = findViewById(R.id.myTextView);
 Typeface customFont = Typeface.createFromAsset(getAssets(), "fonts/Brunson.ttf");
 myText.setTypeface(customFont);

Notes:

    • Make sure the font file is spelled correctly.
    • Use .ttf or .otf fonts for compatibility.
    • If targeting newer Android versions, prefer using res/font.

Done!

You’ve now successfully used a custom font in your Android app. Custom fonts can improve your app’s branding and user experience when used properly.