Try {class<?> mclass = class.forname ("Com.android.server.wifi.WifiSettingsStore"); Constructor Con=mclass.getdeclaredconstructor (Context.class); if (!con.isaccessible ()) {con.setaccessible (true);} Object store = con.newinstance (this); Method[] methods = Mclass.getdeclaredmethods (); Method method = Null;for (method m:methods) {if (M.getname (). Equalsignorecase ("getpersistedscanalwaysavailable")) { method = M;break;}} if (!method.isaccessible ()) {method.setaccessible (true);} Object a = Method.invoke (store); LOG.E ("A", a.tostring ());} catch (ClassNotFoundException e) {//TODO auto-generated catch Blocke.printstacktrace ();} catch (Exception e) {e.printstacktrace ();}
Android system-level API contains a lot of classes, of course, these underlying classes will be the public API link, but sometimes you may need to break through the limitations of the system to do something, then this time the reflection is a sharp weapon.
This does not reflect the meaning of the reflection, give the above examples, mainly to illustrate. In the system, we can get the actual examples of the classes that exist.
The private property (non-final) and private methods in the call, thus bypassing the system's limitations.
Reflection calls Android system-level API functions