[Android] start/stop thumbnailer in onResume/onPause.

Sébastien Toque git at videolan.org
Sat Sep 29 13:11:18 CEST 2012


vlc-ports/android | branch: master | Sébastien Toque <xilasz at gmail.com> | Sat Sep 29 13:10:07 2012 +0200| [d51a70a82b8461fa74994037fb10a50e0a2aba9d] | committer: Sébastien Toque

start/stop thumbnailer in onResume/onPause.

onPause is called way more often than onStart, causing the thumbnailer to work only the first time.

see here for activity lifecycle : http://developer.android.com/reference/android/app/Activity.html

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

 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 894b847..18e3ddb 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -273,14 +273,6 @@ public class MainActivity extends SherlockFragmentActivity {
     }
 
     @Override
-    protected void onStart() {
-        /* Start the thumbnailer */
-        VideoListFragment f = (VideoListFragment)mSidebarAdapter.getFragment("video");
-        ThumbnailerManager.getInstance(this).start(f);
-        super.onStart();
-    }
-
-    @Override
     protected void onResume() {
         mAudioController.addAudioPlayer(mAudioPlayer);
         AudioServiceController.getInstance().bindAudioService(this);
@@ -312,6 +304,11 @@ public class MainActivity extends SherlockFragmentActivity {
 
         if (startFromNotification)
             getIntent().removeExtra(AudioService.START_FROM_NOTIFICATION);
+
+        /* Start the thumbnailer */
+        VideoListFragment f = (VideoListFragment)mSidebarAdapter.getFragment("video");
+        ThumbnailerManager.getInstance(this).start(f);
+
         super.onResume();
     }
 



More information about the Android mailing list