我试图用这个 Android 类找出反射:
Class<?> c = Class.forName("com.android.internal.widget.LockPatternUtils");
Method method = c.getDeclaredMethod("getKeyguardStoredPasswordQuality");
method.setAccessible(true);
Object object = method.invoke(c); // Error with this line
result = object.toString());
该方法getKeyguardStoredPasswordQuality
被声明为(无参数):
public int getKeyguardStoredPasswordQuality() {
// codes here
}
我得到的错误是:
Exception: java.lang.IllegalArgumentException: expected receiver of type com.android.internal.widget.LockPatternUtils, but got java.lang.Class<com.android.internal.widget.LockPatternUtils>
我如何声明com.android.internal.widget.LockPatternUtils
为接收方?