public class FingerprintManager {
* @hide
*/
// this class is hidden
public static abstract class EnrollmentCallback {
public void onEnrollmentError(int errMsgId, CharSequence errString) { }
public void onEnrollmentHelp(int helpMsgId, CharSequence helpString) { }
public void onEnrollmentProgress(int remaining) { }
};
}
隐藏了EnrollmentCallback类。有没有办法通过反射来实例化EnrollmentCallback类,这相当于:
EnrollmentCallback callbackObject = new EnrollmentCallback ()
{
public void onEnrollmentError(int errMsgId, CharSequence errString) { }
public void onEnrollmentHelp(int helpMsgId, CharSequence helpString) { }
public void onEnrollmentProgress(int remaining) { }
};
答案 0 :(得分:2)
没有。有可能使用字节码操作库(如ASM)来做到这一点,但是如果不扩展它并实现任何缺失({{abstract
类,它就无法实例化{{1}}类。 1}})方法。你不能用Java反射做到这一点。