[Android] MainActivity: make the back button work properly

Edward Wang git at videolan.org
Sun Aug 12 04:28:04 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sat Aug 11 13:37:32 2012 -0400| [fcc7b36df8044839849e3f15a871ce412779b359] | committer: Edward Wang

MainActivity: make the back button work properly

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 74d3763..5ee70b8 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -264,6 +264,16 @@ public class MainActivity extends SherlockFragmentActivity {
         reloadPreferences();
     }
 
+    @Override
+    public void onBackPressed() {
+        if(mMenu.isBehindShowing()) {
+            /* Close the menu first */
+            mMenu.showAbove();
+        } else {
+            super.onBackPressed();
+        }
+    }
+
     /** Create menu from XML
      */
     @Override



More information about the Android mailing list