samedi 26 novembre 2016

Want to access this com.android.settings.wifi.AccessPointState using reflection API

I want to access [AccessPointState] http://ift.tt/2flbDlA using relfection API. For this I am using.

private String getSecurityFromReflaction(){
    String str ;
    String packageToBeAccessed ="com.android.settings.wifi.AccessPointState";
    try {
        Class<?> accessPointStateClass = Class.forName(packageToBeAccessed);
        Object object = accessPointStateClass.getConstructor(Context.class).newInstance(this);
        Method getHumanReadableSecurity = accessPointStateClass.getMethod("getHumanReadableSecurity");
        str =  (getHumanReadableSecurity.invoke(object)) + "";
    }catch(Exception e){

        e.printStackTrace();
        str=null;
    }
    return str;

}

I am getting this error enter image description here

Please help.





Aucun commentaire:

Enregistrer un commentaire