[Android] MainActivity: call getFragment before restoring the view

Ludovic Fauvet git at videolan.org
Sat Sep 29 16:18:28 CEST 2012


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Sat Sep 29 15:49:01 2012 +0200| [fda7235a31b9306a88815b5908049d319475ee90] | committer: Ludovic Fauvet

MainActivity: call getFragment before restoring the view

Calling the getFragment method from SidebarAdapter after restoring the
view is wrong because it will replace the restored fragment by the last
instantiated one in the SidebarAdapter fragment factory.

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 01914b0..4ace498 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -280,6 +280,10 @@ public class MainActivity extends SherlockFragmentActivity {
         AudioServiceController.getInstance().bindAudioService(this);
         Boolean startFromNotification = getIntent().hasExtra(AudioService.START_FROM_NOTIFICATION);
 
+        /* Start the thumbnailer */
+        VideoListFragment f = (VideoListFragment)mSidebarAdapter.getFragment("video");
+        mThumbnailerManager.start(f);
+
         /* Restore last view */
         Fragment current = getSupportFragmentManager()
                 .findFragmentById(R.id.fragment_placeholder);
@@ -307,10 +311,6 @@ public class MainActivity extends SherlockFragmentActivity {
         if (startFromNotification)
             getIntent().removeExtra(AudioService.START_FROM_NOTIFICATION);
 
-        /* Start the thumbnailer */
-        VideoListFragment f = (VideoListFragment)mSidebarAdapter.getFragment("video");
-        mThumbnailerManager.start(f);
-
         super.onResume();
     }
 



More information about the Android mailing list