[Android] Keep a reference to MediaLibrary in VLC App
Geoffrey Métais
git at videolan.org
Wed Mar 15 17:42:47 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Mar 15 14:21:15 2017 +0100| [68c1dd9012ab92a2ec435ab1e3d58d10e61006eb] | committer: Geoffrey Métais
Keep a reference to MediaLibrary in VLC App
> https://code.videolan.org/videolan/vlc-android/commit/68c1dd9012ab92a2ec435ab1e3d58d10e61006eb
---
vlc-android/src/org/videolan/vlc/VLCApplication.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/VLCApplication.java b/vlc-android/src/org/videolan/vlc/VLCApplication.java
index fd386c4..9e1f4d8 100644
--- a/vlc-android/src/org/videolan/vlc/VLCApplication.java
+++ b/vlc-android/src/org/videolan/vlc/VLCApplication.java
@@ -56,6 +56,7 @@ public class VLCApplication extends Application {
public final static String ACTION_MEDIALIBRARY_READY = "VLC/VLCApplication";
private static VLCApplication instance;
+ private static Medialibrary sMedialibraryInstance;
public final static String SLEEP_INTENT = Strings.buildPkgString("SleepIntent");
@@ -245,7 +246,10 @@ public class VLCApplication extends Application {
}
public static synchronized Medialibrary getMLInstance() {
- VLCInstance.get(); // ensure VLC is loaded before medialibrary
- return Medialibrary.getInstance();
+ if (sMedialibraryInstance == null) {
+ VLCInstance.get(); // ensure VLC is loaded before medialibrary
+ sMedialibraryInstance = Medialibrary.getInstance();
+ }
+ return sMedialibraryInstance;
}
}
More information about the Android
mailing list