本人想调用一个静态内部类中的一个方法,但是不能得到它?希望能帮帮忙
就是这个静态内部类 : android.os.Environment.UserEnvironment
就是这个静态内部类 : android.os.Environment.UserEnvironment
Class<?> class_UserEnvironment = Class.forName("android.os.Environment") .getDeclaredClasses()[0]; Method method_getExternalDirs = class_UserEnvironment .getMethod("getExternalDirs", null);
异常为:
java.lang.NoSuchMethodException: getExternalDirs [] at java.lang.Class.getMethod(Class.java:664) at java.lang.Class.getMethod(Class.java:643) at c508.yangming.mysdcard.MySDCard.getSDCardPaths(MySDCard.java:231) at c508.yangming.mysdcard.ActivityMain.onCreate(ActivityMain.java:15) at android.app.Activity.performCreate(Activity.java:5990) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2377) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2486) at android.app.ActivityThread.access$800(ActivityThread.java:164) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1358) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:147) at android.app.ActivityThread.main(ActivityThread.java:5513) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:971) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:766)
解决方案
2
本人不知道该怎么回答你这个问题
38
UserEnvironment是Environment的内部类?中间不要用点连接,用$符号试试