[Android] Fix preferences fragment overload

Geoffrey Métais git at videolan.org
Tue Oct 27 16:12:49 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Oct 27 16:11:38 2015 +0100| [a6977cae3e1199b785aeb4bd3a4c9142d19fc0c9] | committer: Geoffrey Métais

Fix preferences fragment overload

Add fragment at activity creation only, not after a rotation/restore

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

 .../org/videolan/vlc/gui/preferences/PreferencesActivity.java |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/vlc-android/vanilla/src/org/videolan/vlc/gui/preferences/PreferencesActivity.java b/vlc-android/vanilla/src/org/videolan/vlc/gui/preferences/PreferencesActivity.java
index 3a31c51..cfdd3e8 100644
--- a/vlc-android/vanilla/src/org/videolan/vlc/gui/preferences/PreferencesActivity.java
+++ b/vlc-android/vanilla/src/org/videolan/vlc/gui/preferences/PreferencesActivity.java
@@ -24,7 +24,6 @@ import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.preference.PreferenceManager;
-import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.widget.Toolbar;
 import android.view.MenuItem;
@@ -61,9 +60,11 @@ public class PreferencesActivity extends AppCompatActivity implements PlaybackSe
 
         setContentView(R.layout.preferences_activity);
         setSupportActionBar((Toolbar) findViewById(R.id.main_toolbar));
-        getSupportFragmentManager().beginTransaction()
-                .add(R.id.fragment_placeholder, new PreferencesFragment())
-                .commit();
+        if (savedInstanceState == null) {
+            getSupportFragmentManager().beginTransaction()
+                    .replace(R.id.fragment_placeholder, new PreferencesFragment())
+                    .commit();
+        }
     }
 
     @Override



More information about the Android mailing list