-1

I'm trying to use a custom font on a TextView... but i got that exception when when run my app

 
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setTypeface(android.graphics.Typeface)' on a null object reference




in the right path and that's my code:


My XML

FreeMan
  • 35
  • 3

2 Answers2

1

Problem is not connected with your custom font - it is connected with TextView.

You are not inflating layout to HomeActivity. Missing part:

setContentView(R.layout.your_home_activity_layout)

Put it between lines protected void onCreate() and SetFont usfnt1

wdeb
  • 61
  • 1
  • 4
1

Have you tried setting your content view? Add the follow in your onCreate()

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);