summaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/android/launcher/AssetDexClassLoader.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/jogamp/android/launcher/AssetDexClassLoader.java')
-rw-r--r--src/java/jogamp/android/launcher/AssetDexClassLoader.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/java/jogamp/android/launcher/AssetDexClassLoader.java b/src/java/jogamp/android/launcher/AssetDexClassLoader.java
new file mode 100644
index 0000000..ec3ae6c
--- /dev/null
+++ b/src/java/jogamp/android/launcher/AssetDexClassLoader.java
@@ -0,0 +1,29 @@
+package jogamp.android.launcher;
+
+import java.net.URL;
+
+import android.util.Log;
+
+import dalvik.system.DexClassLoader;
+
+public class AssetDexClassLoader extends DexClassLoader {
+ private static final boolean DEBUG = false;
+ private static final String assets_folder = "assets/";
+
+ public AssetDexClassLoader(String dexPath, String dexOutputDir, String libPath, ClassLoader parent) {
+ super(dexPath, dexOutputDir, libPath, parent);
+ if(DEBUG) {
+ Log.d(AssetDexClassLoader.class.getSimpleName(), "ctor: dexPath " + dexPath + ", dexOutputDir " + dexOutputDir + ", libPath " + libPath + ", parent " + parent);
+ }
+ }
+
+ @Override
+ public URL findResource(String name) {
+ final String assetName = name.startsWith(assets_folder) ? name : assets_folder + name ;
+ URL url = super.findResource(assetName);
+ if(DEBUG) {
+ Log.d(AssetDexClassLoader.class.getSimpleName(), "findResource: " + name + " -> " + assetName + " -> " + url);
+ }
+ return url;
+ }
+}