[Android] Do not unregister Receivers that are not registered

Jean-Baptiste Kempf git at videolan.org
Tue Apr 8 18:24:15 CEST 2014


vlc-ports/android | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Apr  8 18:20:05 2014 +0200| [7ed34288e793c8403edde524ae6eb01c27cde5d8] | committer: Jean-Baptiste Kempf

Do not unregister Receivers that are not registered

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=7ed34288e793c8403edde524ae6eb01c27cde5d8
---

 vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index 0392ce7..3842e64 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -64,7 +64,10 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
         super.onCreate(savedInstanceState);
 
         mDirectoryAdapter = new DirectoryAdapter(getActivity());
+    }
 
+    @Override
+    public void onStart() {
         IntentFilter filter = new IntentFilter();
         filter.addAction(Intent.ACTION_MEDIA_MOUNTED);
         filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
@@ -99,8 +102,8 @@ public class DirectoryViewFragment extends SherlockListFragment implements ISort
     }
 
     @Override
-    public void onDestroy() {
-        super.onDestroy();
+    public void onStop() {
+        super.onStop();
         getActivity().unregisterReceiver(messageReceiver);
     }
 



More information about the Android mailing list