我正在编写一个应用程序来查看所有存在的 wifi 连接。到目前为止,我已经开始工作了。当你按下提交按钮时,你会得到一个 wifi 连接列表,如果你再次按下它,它将更新连接/值。但是,此后任何时候按下它,值都不会再更新。如果有人可以看看我的方法并引导我朝着正确的方向前进,那就太好了。麻烦的根源是:
private void submitButton() { // 检查连接的方法
wInfo = wifi.getConnectionInfo();
table.removeAllViewsInLayout(); // used to clear the table of the last update
if(wifi.isWifiEnabled()){ // Check to make sure wifi is actually on
List<ScanResult> sr = wifi.getScanResults();
for(ScanResult scan : sr){
// Custom Class to cut down on code
TableAdapter ta = new TableAdapter(this, table);
ta.addTableRow();
ta.addImage(wifi, scan);
ta.addTvN(this, scan);
ta.addTvSi(this, scan);
ta.addTvSp(this);
ta.construct(); // Same as addView(Ojbect to add to view)
}
提前致谢!