I am getting this error on using a custom font. I have tried using the code in MainActivity and the Respective xml activity(Enquiry) too ( in this case there's no error but the font wont apply).
MainActivity
public class MainActivity extends AppCompatActivity
        implements NavigationView.OnNavigationItemSelectedListener {
    WebView webView;
   TextView tv_appname;
    Typeface typeface;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        String fontpath="font/batman.ttf";
        tv_appname=(TextView)findViewById(R.id.tv_appname);
        typeface= Typeface.createFromAsset(getAssets(),fontpath);
        tv_appname.setTypeface(typeface);
Acitivity Enquiry(In which the text is placed whose font I want to change)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg"
    tools:context="mayank2511.galgotiasuniversity.EnquiryActivity"
    android:id="@+id/nav_enq"
    android:paddingLeft="20dp"
    android:orientation="vertical">
    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Enquiry Form"
        android:textSize="34sp"
        android:textColor="#fff"
        android:id="@+id/tv_appname"
        android:layout_marginTop="10dp"
        android:gravity="center"/>
Enquiry Activity (incase it helps- it's commented rn)
public class EnquiryActivity extends AppCompatActivity {
   /* TextView tv_appname;
    Typeface typeface; */
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_enquiry);
        /*String fontpath="font/batman.ttf";
        tv_appname=(TextView)findViewById(R.id.tv_appname);
        typeface= Typeface.createFromAsset(getAssets(),fontpath);
        tv_appname.setTypeface(typeface);
        getSupportActionBar().hide();*/
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
}
 
     
    