Code example for WifiManager

Methods: getConfiguredNetworks

1
            mInflater = LayoutInflater.from(mContext);
            reloadNetworks(); 
        } 
 
        private void reloadNetworks() { 
            mNetworks = mWifiManager.getConfiguredNetworks();
            if (mNetworks == null) {
                mNetworks = new ArrayList<WifiConfiguration>();
            } 
 
            // Sort network list by priority (or by network id if the priority is the same) 
            Collections.sort(mNetworks, new Comparator<WifiConfiguration>() {
                @Override 
                public int compare(WifiConfiguration lhs, WifiConfiguration rhs) {
                    // > priority -- > lower position 
                    if (lhs.priority < rhs.priority) return 1;
                    if (lhs.priority > rhs.priority) return -1;
                    // < network id -- > lower position 
                    if (lhs.networkId < rhs.networkId) return -1;
                    if (lhs.networkId > rhs.networkId) return 1;
                    return 0;