[Android] Unregister callbacks sooner to avoir crash

Geoffrey Métais git at videolan.org
Wed Nov 23 15:20:41 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov 22 18:18:59 2016 +0100| [8f317d05edc00b699676d0a8bd4088775ae67409] | committer: Geoffrey Métais

Unregister callbacks sooner to avoir crash

> https://code.videolan.org/videolan/vlc-android/commit/8f317d05edc00b699676d0a8bd4088775ae67409
---

 vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 9f2d150..3c73b39 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -197,12 +197,16 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
 
     protected void onResume() {
         super.onResume();
+        if (mService != null)
+            mService.addCallback(this);
         mMediaLibrary.setMediaUpdatedCb(this, Medialibrary.FLAG_MEDIA_UPDATED_VIDEO);
         mBrowseFragment.setBrandColor(getResources().getColor(R.color.orange800));
     }
 
     protected void onPause() {
         super.onPause();
+        if (mService != null)
+            mService.removeCallback(this);
         mMediaLibrary.removeMediaUpdatedCb();
     }
 



More information about the Android mailing list