diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index 70d8520182..5ef5d8f6a0 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -112,6 +112,13 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang outState.putInt("id", pluginId) } + override fun onDestroy() { + super.onDestroy() + PreferenceManager + .getDefaultSharedPreferences(context) + .unregisterOnSharedPreferenceChangeListener(this) + } + private fun addPreferencesFromResourceIfEnabled(p: PluginBase?, rootKey: String?, enabled: Boolean) { if (enabled) addPreferencesFromResourceIfEnabled(p, rootKey) }