2 qq 27751729 qq_27751729 于 2016.01.19 15:27 提问

api隐藏函数调用-失败

private void removeAndDeleteGroup(WifiP2pGroup wifiP2pGroup) {
mManager.removeGroup(mChannel, null);
try {
Method getNetworkId = WifiP2pGroup.class.getDeclaredMethod("getNetworkId");
Integer networkId = (Integer) getNetworkId.invoke(wifiP2pGroup);
Method deletePersistentGroup = WifiP2pManager.class.getDeclaredMethod("deletePersistentGroup",
WifiP2pManager.Channel.class, Integer.class, WifiP2pManager.ActionListener.class);
deletePersistentGroup.invoke(mManager, mChannel, networkId, null);
} catch (NoSuchMethodException e) {
Log.e("WIFI", "Could not delete persistent group", e);
} catch (InvocationTargetException e) {
Log.e("WIFI", "Could not delete persistent group", e);
} catch (IllegalAccessException e) {
Log.e("WIFI", "Could not delete persistent group", e);
}
}
请问上面程序哪里有问题吗?求教

2个回答

caozhy
caozhy   Ds   Rxr 2016.01.19 21:48
rui888
rui888   Ds   Rxr 2016.01.19 15:28

大哥那一句失败了啊,看异常信息啊。

qq_27751729
qq_27751729 getNetworkId调成功了就deletePersistentGroup失败啊
接近 2 年之前 回复
qq_27751729
qq_27751729 调用了getNetworkId和deletePersistentGroup方法,如果可以请给个调用代码,谢谢
接近 2 年之前 回复
qq_27751729
qq_27751729 对反射调用不太熟,网上也看了一些,感觉程序没问题啊,请指教
接近 2 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!