Posts

Showing posts with the label onSharedPreferenceChangeListener

Preference Summary or Secondary Text

Image
In android settings guidelines we can read : Secondary text below is for status, not description… Before Ice Cream Sandwich, we often displayed secondary text below a label to further describe it or provide instructions. Starting in Ice Cream Sandwich, we're using secondary text for status,unless it's a checkbox setting. Unfortunately, at time of writitng, there doesn't seem to be a simple, automated way of doing this. In this post we are going to look at how to achieve it. We can get an example from AdvancedPreferences.java in the Android code samples (API Demos). Step 1: Create a class called MyPreferenceFragment This class extends PreferenceFragment and implements onSharedPreferenceChangeListener as shown below. public class MyPreferenceFragment extends PreferenceFragment implements OnSharedPreferenceChangeListener{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ...