android - Connect to specific network, disable WiFi if the network doesn't exist (My issue in the second part) -


i'm trying add connect specific network, i've made editbox, user enter network wannna connect to, after pressing done, save in sharedpreference, , string , store it.

code deleted, use code in answer .

if initial case connecting network if exist, have boolean , check after while loop see if need disable wifi. like:

    list<wificonfiguration> list = wifimanager.getconfigurednetworks();     boolean connected = false;         for( wificonfiguration : list ) {             if(i.ssid != null && i.ssid.equalsignorecase("\"" + desiredssid + "\"")) {                 log.d("in", "in!");                 wifimanager.disconnect();                 wifimanager.enablenetwork(i.networkid, true);                 wifimanager.reconnect();                 connected = true;                 break;             }     if(!connected){wifimanager.setwifienabled(false);} 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -