First you need to create an 'assets' folder under the 'main' folder and put a font file like .ttf file in it.
assets folder path
this is casual font download link
https://befonts.com/casual-font.html
I hope this is the answer you want. thank you
example)
Typeface mTfRegular = Typeface.createFromAsset(getContext().getAssets(), "OpenSans-Regular.ttf");
setTypeface(mTfRegular)
Another easy way to do this is to use the font family.
this way,
Create a folder called font in the /app/src/main/res/ path, put the font file inside, and write the contents of the Font Family in xml in /app/src/main/res/xml, and then apply the TextView or EditText you want to apply. Apply it using the android: fontFamily property.
Writing the Font Family in XML,
<?xml version="1.0" encoding="utf-8"?>
<font-family xmlns:android="http://schemas.android.com/apk/res/android">
<font
android:fontStyle="normal"
android:fontWeight="400"
android:font="@font/casual_regular" />
<font
android:fontStyle="italic"
android:fontWeight="400"
android:font="@font/casual_italic" />
</font-family>
Apply Fonts to FontView Using TextView,
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="@font/casual"/>