From 95394d6cb370fb8f92f81af00b8183e4f269c9c8 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Fri, 6 Mar 2020 19:13:56 +0100 Subject: [PATCH] Unregister shared preferences properly --- .../androidaps/activities/PreferencesActivity.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java index 328f143836..96a2b23b06 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/activities/PreferencesActivity.java @@ -68,6 +68,12 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this); } + @Override + protected void onDestroy() { + super.onDestroy(); + PreferenceManager.getDefaultSharedPreferences(this).unregisterOnSharedPreferenceChangeListener(this); + } + @Override public void attachBaseContext(Context newBase) { super.attachBaseContext(LocaleHelper.INSTANCE.wrap(newBase));