コード例 #1
0
        @Override
        public void run() {
          if (neighbourAdapter == null) return;

          neighbourAdapter.advanceTime();

          NetpowerctrlApplication.getMainThreadHandler().postDelayed(this, 5000);
        }
コード例 #2
0
        @Override
        public void run() {
          if (broadcastSendJob == null) return;

          discoverIsRunning = true;

          udpSending.addJob(broadcastSendJob);

          NetpowerctrlApplication.getMainThreadHandler().postDelayed(this, 1500);
        }
コード例 #3
0
  @Override
  public void onPause() {
    super.onPause();
    if (udpSending != null) {
      udpSending.interrupt();
      udpSending = null;
    }
    if (udpReceiving != null) {
      if (udpReceiving.isAlive()) udpReceiving.interrupt();
      udpReceiving = null;
    }

    NetpowerctrlApplication.getMainThreadHandler().removeCallbacks(advanceTimeRunnable);
    NetpowerctrlApplication.getMainThreadHandler().removeCallbacks(sendDiscoverMessageRunnable);

    // Stop tcp receiver
    NeighbourDataReceiveService.stop();

    try {
      getActivity().unregisterReceiver(wifiChanged);
    } catch (IllegalArgumentException ignored) {
    }
    wifiChanged = null;
  }