Hello, in the application I display the characteristics of the WiFi network. It is not possible to display a field with the type of network protection. Tell me, what am I doing wrong? ps implementation through fragments
public String getScanResultSecurity(ScanResult scanResult) { final String cap = scanResult.capabilities; final String[] securityModes = {"WEP", "PSK", "EAP", "WPA"}; for (int i = securityModes.length - 1; i >= 0; i--) { if (cap.contains(securityModes[i])) { return securityModes[i]; } } return "OPEN"; } //далее часть кода из onCreateView WifiManager wifiManager = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); String currentSSID = wifiInfo.getSSID(); List<ScanResult> results = wifiManager.getScanResults(); for (ScanResult result : results) { if (currentSSID.equals(result.SSID)) { String securityMode = getScanResultSecurity(result); if (securityMode.equals("WEP")) { textView_network92.setText("WEP"); } else if (securityMode.equals("PSK")) { textView_network92.setText("PSK"); }else if (securityMode.equals("EAP")) { textView_network92.setText("EAP"); }else if (securityMode.equals("WPA")) { textView_network92.setText("WPA") }else textView_network92.setText("OPEN"); } }
textView_network92then used? The value was assigned, and forgot to show. What is written in the logs? - Enikeyschik