Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save carlosesteven/31e7a77736fd39ead295e5fa44e7be7a to your computer and use it in GitHub Desktop.
Save carlosesteven/31e7a77736fd39ead295e5fa44e7be7a to your computer and use it in GitHub Desktop.
Android ListPreference with summary updated automatically
public class ListPreferenceWithSummary extends ListPreference{
public ListPreferenceWithSummary(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ListPreferenceWithSummary(Context context) {
super(context);
}
@Override
public void setValue(String value) {
super.setValue(value);
setSummary(value);
}
@Override
public void setSummary(CharSequence summary) {
super.setSummary(getEntry());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment