title: Connecting to specific wifi sometimes fails on android
body: <p>I am creating an app, which can list out all the available wifi's in a ListView. If I select one of the wifi's in the list, which was cached before in <code>List&lt;WifiConfiguration&gt; list = wifiManager.getConfiguredNetworks();</code> then it should connect to it. If the <code>WifiConfiguration</code> list doesn't contain the selected wifi, then nothing happens. My problem is, that sometimes I select a wifi from the list (which I know for sure is in the <code>WifiConfiguration</code> list), but it doesn't connects to it. Instead it connects back to the previously connected wifi. After some attempts (selecting again and again the same wifi) it connects to it finally. This doesn't happen always, just sometimes. What can be the problem? Here is my code snippet:</p>
  
  <pre><code>// Go through all the cached wifis and check if the selected GoPro was cached before
  for (WifiConfiguration config : configurations) {
      // If it was cached connect to it and that's all
      if (config.SSID != null &amp;&amp; config.SSID.equals("\"" + mDrawerListView.getAdapter().getItem(position) + "\"")) {
          // Log
          Log.i("onReceive", "Connecting to: " + config.SSID);
          mWifiManager.disconnect();
          mWifiManager.enableNetwork(config.networkId, true);
          mWifiManager.reconnect();
          break;
       }
  }
  </code></pre>