主な目標は、独自の実装で Android システム クラス (Activity、View など) をオーバーライドすることです。
http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html
カスタムクラスローディング用のClassLoaderを実装し、非システムクラス(カスタムクラス)のローディングが動作します。
しかし、実装で Activity をロードしようとすると、ClassLoader のキャッシュに既にこのクラスがあるため、ロードされません。
/**
* Returns the class with the specified name if it has already been loaded
* by the virtual machine or {@code null} if it has not yet been loaded.
*
* @param className
* the name of the class to look for.
* @return the {@code Class} object or {@code null} if the requested class
* has not been loaded.
*/
protected final Class<?> findLoadedClass(String className) {
ClassLoader loader;
if (this == BootClassLoader.getInstance())
loader = null;
else
loader = this;
return VMClassLoader.findLoadedClass(loader, className);
}
システムではなく独自のクラスを注入するようにクラスローダーを変更するにはどうすればよいですか?