i am trying to set a custom TTF font inside my PreferenceActivity.
The preference activity contains 2 ListPreferences, nothing else. Inside my PreferenceActivity, i have this 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);
// this works correctly, i'm able to get the 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 the typeface
}
But this doesn't work form me. The fontface remains the same before and after selecting an item from the ListPreference