2011-09-20 25 views
0

我正在寫一個應用程序來查看所有存在的wifi連接。到目前爲止,我得到了一些工作。當你按提交按鈕時,你會得到一個無線連接列表,如果你再按一次,它會更新連接/值。但是,無論何時您在此之後按下它,這些值都不會再更新。如果有人可以看看我的方法,並引導我朝着正確的方向發展,那就太好了。麻煩的來源是:試圖讓WifiManger更新

私人無效提交按鈕(){//方法檢查事先連接

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) 

    }  

謝謝!

+0

如果你需要更多的代碼來看看,請讓我知道,我會很高興地發佈它。 –

+0

當你說這些值不再更新時,它是什麼沒有更新,具體是什麼? – Juxtaposition

+0

行ta.addTableRow();圖片ta.addImage();網絡名稱ta.TvN();和信號強度ta.TvSi(); ta.addTvSp現在只是一個隔離器。 –

回答