[Android] App initialization: prevent ClassCastException
Geoffrey Métais
git at videolan.org
Fri Dec 21 11:43:14 CET 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Dec 21 11:38:22 2018 +0100| [28bda134c9f775a2e221b4205607e6415e37725f] | committer: Geoffrey Métais
App initialization: prevent ClassCastException
> https://code.videolan.org/videolan/vlc-android/commit/28bda134c9f775a2e221b4205607e6415e37725f
---
vlc-android/src/org/videolan/vlc/StartActivity.java | 2 +-
vlc-android/src/org/videolan/vlc/VLCApplication.java | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/StartActivity.java b/vlc-android/src/org/videolan/vlc/StartActivity.java
index ed65b6065..14a99d4eb 100644
--- a/vlc-android/src/org/videolan/vlc/StartActivity.java
+++ b/vlc-android/src/org/videolan/vlc/StartActivity.java
@@ -57,7 +57,6 @@ public class StartActivity extends FragmentActivity {
if (AndroidUtil.isNougatOrLater)
UiTools.setLocale(this);
final Intent intent = getIntent();
- final boolean tv = showTvUi();
final String action = intent != null ? intent.getAction(): null;
if (Intent.ACTION_VIEW.equals(action) && intent.getData() != null
@@ -88,6 +87,7 @@ public class StartActivity extends FragmentActivity {
final boolean upgrade = firstRun || savedVersionNumber != currentVersionNumber;
if (upgrade) settings.edit().putInt(Constants.PREF_FIRST_RUN, currentVersionNumber).apply();
FileUtils.copyLua(getApplicationContext(), upgrade);
+ final boolean tv = showTvUi();
// Route search query
if (Intent.ACTION_SEARCH.equals(action) || "com.google.android.gms.actions.SEARCH_ACTION".equals(action)) {
startActivity(intent.setClass(this, tv ? org.videolan.vlc.gui.tv.SearchActivity.class : SearchActivity.class));
diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index b6eacafcd..e403e4d67 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -139,6 +139,7 @@ public class VLCApplication extends Application {
catch (InvocationTargetException ignored) {}
catch (NoSuchMethodException ignored) {}
catch (ClassNotFoundException ignored) {}
+ catch (ClassCastException ignored) {}
return instance;
}
}
More information about the Android
mailing list