Skip to content

Instantly share code, notes, and snippets.

@brunomateus
Last active June 6, 2019 04:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save brunomateus/5617025 to your computer and use it in GitHub Desktop.
Save brunomateus/5617025 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