[Android] Don't leave the user hanging if LibVLC couldn't be initialized

Edward Wang git at videolan.org
Mon Aug 13 02:33:53 CEST 2012


android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sun Aug 12 20:33:49 2012 -0400| [14b1416654e250e019f06d21172d611c97c89fe7] | committer: Edward Wang

Don't leave the user hanging if LibVLC couldn't be initialized

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

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

diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 4ecd71a..eee1aea 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -134,18 +134,25 @@ public class MainActivity extends SherlockFragmentActivity {
         listView.setBackgroundColor(Color.parseColor("#1f3f61"));
         mMenu.setViewBehind(sidebar);
 
-        super.onCreate(savedInstanceState);
-
         /* Get settings */
         mSettings = PreferenceManager.getDefaultSharedPreferences(this);
         LibVLC.useIOMX(this);
         try {
-            // Start libvlc
+            // Start LibVLC
             LibVLC.getInstance();
         } catch (LibVlcException e) {
             e.printStackTrace();
+            super.onCreate(null);
+            Intent i = new Intent(this, CompatErrorActivity.class);
+            i.putExtra("runtimeError", true);
+            i.putExtra("message", "LibVLC failed to initialize (LibVlcException)");
+            startActivity(i);
+            finish();
+            return;
         }
 
+        super.onCreate(savedInstanceState);
+
         /* Initialize variables */
         mInfoLayout = v_main.findViewById(R.id.info_layout);
         mInfoProgress = (ProgressBar) v_main.findViewById(R.id.info_progress);



More information about the Android mailing list