Android反射获取⼀个⽅法(⽅法的参数不⼀样)private Method forget;
private Method connect_netID;
private Method connect_wifiConfig;
private Method save;
public Compatimpl17() {
try {与爱同行
Class ActionListener = Class.forName("android.wifi.WifiManager$ActionListener", fal, null);
connect_netID = DeclaredMethod("connect", int.class, ActionListener);
金融消费者
connect_wifiConfig = DeclaredMethod("connect", WifiConfiguration.class, ActionListener);
绳子英语forget = DeclaredMethod("forget", int.class, ActionListener);
save = DeclaredMethod("save", WifiConfiguration.class, ActionListener);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
木字旁的字大全e.printStackTrace();
}
}
public boolean connect(int networkId) {
韩国端午节申遗成功了吗try {
connect_netID.invoke(getManager(), networkId, null);
睡美人的故事生日聚会图片return true;
} catch (Exception e) {头发粗
e.printStackTrace();
}
return fal;
}