[Android] Unregister preferences listener on stop

Geoffrey Métais git at videolan.org
Tue Apr 10 10:52:17 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Apr 10 10:18:32 2018 +0200| [99cf7dde737ac9d5690f27b2ea222b58c55cb967] | committer: Geoffrey Métais

Unregister preferences listener on stop

> https://code.videolan.org/videolan/vlc-android/commit/99cf7dde737ac9d5690f27b2ea222b58c55cb967
---

 .../src/org/videolan/vlc/gui/preferences/PreferencesAudio.java     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.java b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.java
index c90816c07..41aef72db 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.java
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.java
@@ -31,7 +31,6 @@ import android.support.v7.preference.TwoStatePreference;
 
 import org.videolan.libvlc.util.AndroidUtil;
 import org.videolan.libvlc.util.HWDecoderUtil;
-import org.videolan.vlc.PlaybackService;
 import org.videolan.vlc.R;
 import org.videolan.vlc.util.Constants;
 import org.videolan.vlc.util.VLCInstance;
@@ -73,6 +72,12 @@ public class PreferencesAudio extends BasePreferenceFragment implements SharedPr
         getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
     }
 
+    @Override
+    public void onStop() {
+        super.onStop();
+        getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
+    }
+
     @Override
     public boolean onPreferenceTreeClick(Preference preference) {
         if (preference.getKey() == null) return false;



More information about the Android mailing list