[Android] Fix cast of Application instance

Geoffrey Métais git at videolan.org
Tue Mar 19 13:59:29 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 19 13:31:51 2019 +0100| [01e36e7d74df0bde51995345f612f53d0709d012] | committer: Geoffrey Métais

Fix cast of Application instance

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

 vlc-android/src/org/videolan/vlc/VLCApplication.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index 7c10ac8e5..12b286377 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -58,7 +58,7 @@ public class VLCApplication extends Application {
     public final static String TAG = "VLC/VLCApplication";
 
     public final static String ACTION_MEDIALIBRARY_READY = "VLC/VLCApplication";
-    private static volatile VLCApplication instance;
+    private static volatile Application instance;
 
     public final static String SLEEP_INTENT = Strings.buildPkgString("SleepIntent");
 
@@ -143,7 +143,7 @@ public class VLCApplication extends Application {
         if (instance != null) return instance;
         else {
             try {
-                instance = (VLCApplication) Class.forName("android.app.ActivityThread").getDeclaredMethod("currentApplication").invoke(null);
+                instance = (Application) Class.forName("android.app.ActivityThread").getDeclaredMethod("currentApplication").invoke(null);
             } catch (IllegalAccessException ignored) {}
             catch (InvocationTargetException ignored) {}
             catch (NoSuchMethodException ignored) {}



More information about the Android mailing list