0

i will develop an android project and i declare a function, which is set to project fonts but when i testing ptoject on device, then i will get runtime exception.here is my function.please help us

private void configureFonts() {
    Typeface tf = ConfigureFont.configure(MainActivity.this,
            "Roboto-Light.ttf");
    tf = ConfigureFont.configure(MainActivity.this, "Roboto-Thin.ttf");
    etUsername.setTypeface(tf);
    etPassword.setTypeface(tf);
    tf = ConfigureFont.configure(MainActivity.this, "Roboto-Bold.ttf");
    btnLogin.setTypeface(tf);
}


public class ConfigureFont {
public static Typeface configure (Context context, String fontName) {
    Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/" + fontName);
    return tf;
}

}

0 Answers0