[Android] Fix MainActivity restart after settings change

Geoffrey Métais git at videolan.org
Wed Jan 6 11:15:45 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Jan  6 10:53:21 2016 +0100| [a1a4a2c57d658e72195028fb2a4a0f458fc25beb] | committer: Geoffrey Métais

Fix MainActivity restart after settings change

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index c3e4d84..a102d7a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -653,11 +653,13 @@ public class MainActivity extends AudioPlayerContainerActivity implements Search
             if (resultCode == PreferencesActivity.RESULT_RESCAN)
                 mMediaLibrary.scanMediaItems(true);
             else if (resultCode == PreferencesActivity.RESULT_RESTART) {
-                final Intent intent = getIntent();
-                if (intent != null && intent.getAction() != null) {
-                    finish();
-                    startActivity(intent);
-                }
+                Intent intent = getIntent();
+                if (intent == null)
+                    intent = new Intent(MainActivity.this, MainActivity.class);
+                if (intent.getAction() == null)
+                    intent.setAction(Intent.CATEGORY_LAUNCHER);
+                finish();
+                startActivity(intent);
             }
         } else if (requestCode == ACTIVITY_RESULT_OPEN && resultCode == RESULT_OK){
             MediaUtils.openUri(this, data.getData());



More information about the Android mailing list