public void run() { while (!WifiUtils.isWifiApEnabled()) { if (!this.running) return; try { Thread.sleep(2000); // 扫描间隔 } catch (InterruptedException e) { e.printStackTrace(); } handler.sendEmptyMessage(WifiApConst.ApScanResult); } }
/** 初始化控件设置 * */ protected void initAction() { if (!WifiUtils.isWifiConnect() && !WifiUtils.isWifiApEnabled()) { // 无开启热点无连接WIFI WifiUtils.OpenWifi(); } if (WifiUtils.isWifiConnect()) { // Wifi已连接 mTvStatusInfo.setText(getString(R.string.wifiap_text_wifi_connected) + WifiUtils.getSSID()); } if (WifiUtils.isWifiEnabled() && !WifiUtils.isWifiConnect()) { // Wifi已开启,未连接 mTvStatusInfo.setText(getString(R.string.wifiap_text_wifi_1_0)); } mSearchWifiThread.start(); }