Code example for PathClassLoader

0
        if (parent == null)
            throw new IllegalStateException();
        //my_app, my_libraryをセパレータで区切ってdexPathを構成する 
        String dexPath = libraryCodePath + File.pathSeparator + context.getPackageCodePath();
        //dexPathを指定してPathClassLoaderを構成する 
        PathClassLoader customLoader = new PathClassLoader(dexPath,
                                                           parent);
        return customLoader;
    } 
 
    /** 
     * カスタムしたアプリケーションでActivityをロードする. 
     */ 
    @Override 
    public Activity newActivity(ClassLoader cl,
                                String className,
                                Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
        return super.newActivity(getCustomLoader(getTargetContext()), className, intent);
    } 
 
Experience pair programming with AI  Get Codota for Java