Android 反射机制备份

 try {
            Class<?> cls= Class.forName("android.app.ActivityManager");
//            Object object = cls.newInstance();
            Method method = cls.getDeclaredMethod("getMaxRecentTasksStatic");//该方法是无参的参数
            Log.i(TAG,"method = "+method.invoke(null));
        }catch (Exception e){
            Log.i(TAG,"lsn e = "+e.getMessage());
        }


常用方法:

Android 反射机制备份