android - Setting custom ttf font in preference activity -


i trying set custom ttf font inside preferenceactivity.

the preference activity contains 2 listpreferences, nothing else. inside preferenceactivity, have code:

protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     addpreferencesfromresource(r.xml.prefs);     preferencemanager.getdefaultsharedpreferences(this).registeronsharedpreferencechangelistener(this); }  public void onsharedpreferencechanged(sharedpreferences sharedpreferences, string key) {     preference conpref = findpreference(key);      // works correctly, i'm able correct text form tv.gettext();             textview tv = (textview) conpref.getview(null, null).findviewbyid(android.r.id.title);      typeface gilfontbook = typeface.createfromasset(getassets(), "fonts/gilbook.ttf");     tv.settypeface(gilfontbook);  // doesnt change typeface } 

but doesn't work form me. fontface remains same before , after selecting item listpreference

as far know you've extend preferenceactivity class that. answer helped me:

https://stackoverflow.com/a/13193623/814353


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -