[Android] Fix ducplicate fragments in secondary activity

Geoffrey Métais git at videolan.org
Tue Apr 14 14:30:23 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Apr 14 14:29:49 2015 +0200| [f28cae204e0284b83f321a98cbe651cb76f05df0] | committer: Geoffrey Métais

Fix ducplicate fragments in secondary activity

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

 .../src/org/videolan/vlc/gui/SecondaryActivity.java      |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
index 62970e5..d1ddf7e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.java
@@ -25,7 +25,6 @@ package org.videolan.vlc.gui;
 import android.os.Bundle;
 import android.preference.PreferenceManager;
 import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.ActionBarActivity;
 import android.support.v7.widget.Toolbar;
@@ -40,13 +39,13 @@ import org.videolan.vlc.gui.audio.EqualizerFragment;
 import org.videolan.vlc.gui.video.MediaInfoFragment;
 import org.videolan.vlc.gui.video.VideoGridFragment;
 import org.videolan.vlc.gui.video.VideoListAdapter;
-import org.videolan.vlc.interfaces.IRefreshable;
 import org.videolan.vlc.interfaces.ISortable;
-import org.videolan.vlc.util.Util;
 
 import java.util.ArrayList;
+import java.util.List;
 
 public class SecondaryActivity  extends ActionBarActivity {
+    public final static String TAG = "VLC/EqualizerFragment";
 
     Fragment mFragment;
     @Override
@@ -67,9 +66,12 @@ public class SecondaryActivity  extends ActionBarActivity {
             finish();
             return;
         }
-        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
-            ft.add(R.id.fragment_placeholder, mFragment);
-            ft.commit();
+
+        if (getSupportFragmentManager().getFragments() == null) {
+            getSupportFragmentManager().beginTransaction()
+            .add(R.id.fragment_placeholder, mFragment)
+            .commit();
+        }
     }
 
     @Override



More information about the Android mailing list