[Android] Fix cast of Application instance

Geoffrey Métais git at videolan.org
Tue Mar 19 15:35:22 CET 2019


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

Fix cast of Application instance

> https://code.videolan.org/videolan/vlc-android/commit/375604b38b3e219df789880c2f34f91b52798fad
---

 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