[Android] Return to the MainActivity after the AudioPlayerActivity finishes

Ludovic Fauvet git at videolan.org
Mon May 27 19:06:12 CEST 2013


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Mon May 27 15:50:39 2013 +0200| [9a29b218f8ea5bfb4f45010a8c186f77c8646225] | committer: Ludovic Fauvet

Return to the MainActivity after the AudioPlayerActivity finishes

When the player is started from a notification (without a backstack) and
it is closed (by calling stop or when the end is reached), the
MainActivity will now always be shown.

In the same way, returning from the application history will launch the
player if it's already running instead of the menu.

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

 .../src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java       |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
index 2a202e1..396dd11 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
@@ -170,8 +170,11 @@ public class AudioPlayerActivity extends Activity implements IAudioPlayer {
 
     @Override
     public void update() {
-        // Exit the player when there is no media
+        // Exit the player and return to the main menu when there is no media
         if (!mAudioController.hasMedia()) {
+            Intent intent = new Intent(this, MainActivity.class);
+            intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
+            startActivity(intent);
             finish();
             return;
         }



More information about the Android mailing list