我知道如何获得Android Wifi扫描,但我无法找出制作列表适配器的最佳方法.我想将SSID和BSSID从扫描绑定到text1和text2.
我一直在做的样本
wifi.startScan();
// get list of the results in object format ( like an array )
List<ScanResult> results = wifi.getScanResults();`
// loop that goes through list
for (ScanResult result : results) {
Toast.makeText(this, result.SSID + " " + result.level,
Toast.LENGTH_SHORT).show();
Run Code Online (Sandbox Code Playgroud)
和:
private void fillDataFromDb() {
Cursor scanCursor = Db.fetchAllScans();
startManagingCursor(scanCursor);`
// Create an array to specify the fields we want to display in the list
// (only TITLE)
String[] from = new String[] { WifiDbAdapter.KEY_BSSID,
WifiDbAdapter.KEY_SSID };
// …Run Code Online (Sandbox Code Playgroud) 我正在创建一个需要互联网连接的应用.因此,当未启用WiFi设置时,我会弹出一条消息以将其打开.但是当它开启时,它并不能连接到WiFi接入点.
有没有办法在列表中显示所有当前可用的WiFi点?
提前致谢