@Override
  protected void onResume() {
    AndroidApplication.getInstance().setCurrentActivity(this);
    LocalBroadcastManager.getInstance(NetworkConfigActivity.this)
        .registerReceiver(
            serviceStartedListener,
            new IntentFilter(BroadcastIntentTypes.networkConnectionSuccessful));

    active = true;
    rescanWifiTask =
        new AsyncTask<Object, Object, Object>() {

          @Override
          protected Object doInBackground(Object... arg0) {

            while (active) {
              SystemClock.sleep(5000);
              wifi.startScan();
            }
            return null;
          }
        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

    if (nfcAdapter != null && nfcAdapter.isEnabled()) {
      nfcAvailable = true;
    }

    // make sure that this activity is the first one which can handle the
    // NFC tags
    if (nfcAvailable) {
      nfcAdapter.enableForegroundDispatch(this, pendingIntent, Utility.getNFCIntentFilters(), null);
    }

    super.onResume();
  }
  @Override
  protected void onResume() {
    AndroidApplication.getInstance().setCurrentActivity(this);
    LocalBroadcastManager.getInstance(this)
        .registerReceiver(
            showNextActivityListener, new IntentFilter(BroadcastIntentTypes.showNextActivity));

    if (nfcAdapter != null && nfcAdapter.isEnabled()) {
      nfcAvailable = true;
    }

    // make sure that this activity is the first one which can handle the
    // NFC tags
    if (nfcAvailable) {
      nfcAdapter.enableForegroundDispatch(this, pendingIntent, Utility.getNFCIntentFilters(), null);
    }

    super.onResume();
  }