问题
I am working on an application where i listed all the WIFI P2P nearby devices in a list. But the problem is that it is showing that device also which wifi is disable now. It is able to detect new devices and can list in listview but not able to remove the old ones. Thanks in advance.
回答1:
In the BrodcastReceiver inside WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION matching action call requestpeers() method and dont call inside anyother match.....also use peers.clear() [that may be ur arraylist of adapter]. before calling requestpeers().
回答2:
it will remove the old one after one second as android system define by default value of 60000 milisecond to refresh the wifi direct peer and there is no way to set the same.check android os code
来源:https://stackoverflow.com/questions/22298581/wifi-p2p-discovery-list-is-not-getting-refreshed