@Override public void onClick(View v) { final WifiConfiguration config = Wifi.getWifiConfiguration(mWifiManager, mScanResult, mScanResultSecurity); boolean result = false; if (config != null) { result = mWifiManager.removeNetwork(config.networkId) && mWifiManager.saveConfiguration(); } if (!result) { Toast.makeText(mFloating, R.string.toastFailed, Toast.LENGTH_LONG).show(); } mFloating.finish(); }
public JSONObject toJSON() { JSONObject obj = new JSONObject(); try { putSafe(obj, "time", time); putSafe(obj, "localtime", localTime); putSafe(obj, "deviceid", SHA1Util.SHA1(deviceId)); JSONArray array = new JSONArray(); try { for (Ping p : pings) { array.put(p.toJSON()); } } catch (Exception e) { } putSafe(obj, "pings", array); JSONArray tmparray = new JSONArray(); try { for (LastMile p : lastMiles) { tmparray.put(p.toJSON()); } } catch (Exception e) { } putSafe(obj, "lastmiles", tmparray); JSONArray array2 = new JSONArray(); for (Screen s : screens) { array2.put(s.toJSON()); } if (screens != null) putSafe(obj, "screens", array2); if (device != null) putSafe(obj, "device", device.toJSON()); if (throughput != null) putSafe(obj, "throughput", throughput.toJSON()); if (gps != null) putSafe(obj, "gps", gps.toJSON()); if (battery != null) putSafe(obj, "battery", battery.toJSON()); if (usage != null) putSafe(obj, "usage", usage.toJSON()); if (network != null) putSafe(obj, "network", network.toJSON()); if (warmupExperiment != null) putSafe(obj, "warmup_experiment", warmupExperiment.toJSON()); if (sim != null) putSafe(obj, "sim", sim.toJSON()); if (wifi != null) putSafe(obj, "wifi", wifi.toJSON()); if (state != null) putSafe(obj, "state", state.toJSON()); if (isManual) putSafe(obj, "isManual", 1); else putSafe(obj, "isManual", 0); if (loss != null) putSafe(obj, "loss", loss.toJSON()); if (ipdv != null) putSafe(obj, "delay_variation", ipdv.toJSON()); } catch (Exception e) { e.printStackTrace(); } printJSON(obj.toString()); return obj; }