FileDocCategorySizeDatePackage
ApplicationLoaders.javaAPI DocAndroid 1.5 API2315Wed May 06 22:41:54 BST 2009android.app

ApplicationLoaders

public class ApplicationLoaders extends Object

Fields Summary
private final HashMap
mLoaders
private static final ApplicationLoaders
gApplicationLoaders
Constructors Summary
Methods Summary
public java.lang.ClassLoadergetClassLoader(java.lang.String zip, java.lang.String appDataDir, java.lang.ClassLoader parent)

        /*
         * This is the parent we use if they pass "null" in.  In theory
         * this should be the "system" class loader; in practice we
         * don't use that and can happily (and more efficiently) use the
         * bootstrap class loader.
         */
        ClassLoader baseParent = ClassLoader.getSystemClassLoader().getParent();

        synchronized (mLoaders) {
            if (parent == null) {
                parent = baseParent;
            }

            /*
             * If we're one step up from the base class loader, find
             * something in our cache.  Otherwise, we create a whole
             * new ClassLoader for the zip archive.
             */
            if (parent == baseParent) {
                ClassLoader loader = (ClassLoader)mLoaders.get(zip);
                if (loader != null) {
                    return loader;
                }
    
                PathClassLoader pathClassloader =
                    new PathClassLoader(zip, appDataDir + "/lib", parent);
                
                mLoaders.put(zip, pathClassloader);
                return pathClassloader;
            }

            return new PathClassLoader(zip, parent);
        }
    
public static android.app.ApplicationLoadersgetDefault()

        return gApplicationLoaders;