I am working on a android application. In this application, I am using Custom font (avenir_bold_font). I am using following method to set up font to buttons.
public static void setButtonFont(Activity activity, Button btnView, String fontType){
Typeface tf = Typeface.createFromAsset(activity.getAssets(),"fonts/"+fontType);
btnView.setTypeface(tf);
}
Using above method am able to set up font to a button without any trouble. But in above method i have creating Typeface object every time any other calls it.
So i have made the changes in above method, I have converted Typeface local variable to Static variable so that it will improve performance, But The moment i created Typeface object as static , it does not work. it does not able to set up font
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire