I am trying to import a font. Looked for some tutorials online and used the instructions. So far I've imported the font onto the assets folder. This is the code that I am using to declare my font type.
Typeface localTypeface1 = Typeface.createFromAsset(getAssets(), "arial.ttf");
I keep getting null pointer exception when I call it.
TextView txtTab = new TextView(this);
txtTab.setTypeface(localTypeface1);
What could be the problem ? This is the exact error in logcat.
11-17 13:10:41.024: E/AndroidRuntime(2262): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{se.copernicus.activity/se.copernicus.activity.Secondactivity}: java.lang.NullPointerException
11-17 13:10:41.024: E/AndroidRuntime(2262): at android.content.ContextWrapper.getAssets(ContextWrapper.java:74)
This is line 74
Typeface localTypeface1 = Typeface.createFromAsset(getAssets(), "arial.ttf");