[android-developers] Re: how to change the font typeface in PreferenceScreen
In my PreferenceActivity I have this: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); setContentView(R.layout.preferences); SharedPreferences sharedPreferences = getSharedPreferences("settings", Context.MODE_PRIVATE); sharedPreferences.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Toast.makeText(getApplicationContext(), key, 0).show(); } }); } To test this solution. But I can't see any Toast. On 11 Paź, 02:16, lbendlin wrote: > you might get lucky > viahttp://developer.android.com/reference/android/content/SharedPreferen... > as I believe this is called when the preference is first rendered. > > And then you can poke the individual preference like so > > public void onSharedPreferenceChanged(SharedPreferences > sharedPreferences, String key) { > Preference pref = findPreference(key); > > if (pref instanceof ListPreference) { > ListPreference listPref = (ListPreference) pref; > pref.setSummary(listPref.getEntry()); > > String pT = (String) pref.getTitle(); > ... > > Alternatively, if you only have a few preferences, you should be able to > address them via their key directly. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: how to change the font typeface in PreferenceScreen
In my PreferenceActivity I have this: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); setContentView(R.layout.preferences); SharedPreferences sharedPreferences = getSharedPreferences("settings", Context.MODE_PRIVATE); sharedPreferences.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Toast.makeText(getApplicationContext(), key, 0).show(); } }); } To test this solution. But I can't see any Toast. On 11 Paź, 02:16, lbendlin wrote: > you might get lucky > viahttp://developer.android.com/reference/android/content/SharedPreferen... > as I believe this is called when the preference is first rendered. > > And then you can poke the individual preference like so > > public void onSharedPreferenceChanged(SharedPreferences > sharedPreferences, String key) { > Preference pref = findPreference(key); > > if (pref instanceof ListPreference) { > ListPreference listPref = (ListPreference) pref; > pref.setSummary(listPref.getEntry()); > > String pT = (String) pref.getTitle(); > ... > > Alternatively, if you only have a few preferences, you should be able to > address them via their key directly. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: how to change the font typeface in PreferenceScreen
In my PreferenceActivity I have this: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.settings); setContentView(R.layout.preferences); SharedPreferences sharedPreferences = getSharedPreferences("settings", Context.MODE_PRIVATE); sharedPreferences.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Toast.makeText(getApplicationContext(), key, 0).show(); } }); } To test this solution. But I can't see any Toast. On 11 Paź, 02:16, lbendlin wrote: > you might get lucky > viahttp://developer.android.com/reference/android/content/SharedPreferen... > as I believe this is called when the preference is first rendered. > > And then you can poke the individual preference like so > > public void onSharedPreferenceChanged(SharedPreferences > sharedPreferences, String key) { > Preference pref = findPreference(key); > > if (pref instanceof ListPreference) { > ListPreference listPref = (ListPreference) pref; > pref.setSummary(listPref.getEntry()); > > String pT = (String) pref.getTitle(); > ... > > Alternatively, if you only have a few preferences, you should be able to > address them via their key directly. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: how to change the font typeface in PreferenceScreen
you might get lucky via http://developer.android.com/reference/android/content/SharedPreferences.OnSharedPreferenceChangeListener.html as I believe this is called when the preference is first rendered. And then you can poke the individual preference like so public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { Preference pref = findPreference(key); if (pref instanceof ListPreference) { ListPreference listPref = (ListPreference) pref; pref.setSummary(listPref.getEntry()); String pT = (String) pref.getTitle(); ... Alternatively, if you only have a few preferences, you should be able to address them via their key directly. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en