I am not getting external font, from creating new class, where i defined external font.
FontStyle.Java
public class FontStyle extends Activity{ public final static String roboto_regular = "fonts/roboto_regular.ttf"; public Typeface font_roboto_regular = Typeface.createFromAsset(getAssets(), roboto_regular); } and MainActivity.Java
public class MainActivity extends Activity { FontStyle font_style; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); fontStyling(); } private void fontStyling() { TextView test= (TextView) findViewById(R.id.tv_test); test.setTypeface(font_style.font_roboto_regular ); } I am getting this error or logcat:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test/com.test.MainActivity}: java.lang.NullPointerException please guy correct me: thanks in advance.