There is a code to disable and enable the Wi-Fi adapter:
String service = Context.WIFI_SERVICE; wifi = (WifiManager)getSystemService(service); public void Connected(){ if (!wifi.isWifiEnabled()){ if (wifi.getWifiState() != WifiManager.WIFI_STATE_ENABLING) wifi.setWifiEnabled(true); }
But how to implement it in a widget?
OnClick
handler? Do right right, there will be no problems. Send the event to the model, let it communicate with theActivity
. - VladD