java - how can i call Android hide Handler(boolean b) constructor? -
android.os.handler class has hide constructor --> void handler(boolean async),
i want call method reflection,but in vain...
here code:
class clazz = class.forname("android.os.handler"); constructor construct = clazz.getconstructor(boolean.class); //constructor construct = clazz.getdeclaredconstructor(boolean.class); construct.setaccessible(true); boolean[] ailments = new boolean[]{true}; handler handler = (handler) construct.newinstance(ailments);
the error message is:
java.lang.nosuchmethodexception: android.os.handler.<init>(boolean) @ java.lang.class.getconstructor0(class.java:3082) @ java.lang.class.getconstructor(class.java:1825)....
i try iterate clazz.getconstructors() returns constructor array, , log paramstype, find looper,callback ...
why can't log out 'boolean'?
public more ...handler(boolean async) { this(null, async); }
i have resolved problem importing framework.jar instead of android.jar in android/sdk/platforms/android+versioncode/
adk had cut down @hide api , internal classes generate android.jar,we can't use these resources unless use framework.jar developing.
see project,it provided complete classes included @hide api , internal classes.
Comments
Post a Comment