Mục tiêu chính là ghi đè lớp hệ thống Android (Hoạt động, Chế độ xem v.v.) với việc triển khai của riêng tôi.Lớp học tùy chỉnh tải/ghi đè các lớp gốc Android
http://android-developers.blogspot.com/2011/07/custom-class-loading-in-dalvik.html
ClassLoader cho lớp tùy chỉnh tải được thực hiện, nạp lớp không thuộc hệ thống (lớp tùy chỉnh) hoạt động.
Nhưng khi tôi cố gắng để tải Hoạt động với thực hiện của tôi - nó không tải, vì ClassLoader đã có lớp này trong bộ nhớ cache của nó:
/**
* 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);
}
Làm thế nào tôi có thể thay đổi lớp loader để tiêm lớp riêng của tôi thay vì của hệ thống?