@Override
 public boolean onContextItemSelected(MenuItem item) {
   if (mSelectedAccessPoint == null) {
     return super.onContextItemSelected(item);
   }
   switch (item.getItemId()) {
     case MENU_ID_CONNECT:
       {
         if (mSelectedAccessPoint.networkId != INVALID_NETWORK_ID) {
           mWifiManager.connect(mSelectedAccessPoint.networkId, mConnectListener);
         } else if (mSelectedAccessPoint.security == AccessPoint.SECURITY_NONE) {
           /** Bypass dialog for unsecured networks */
           mSelectedAccessPoint.generateOpenNetworkConfig();
           mWifiManager.connect(mSelectedAccessPoint.getConfig(), mConnectListener);
         } else {
           showDialog(mSelectedAccessPoint, true);
         }
         return true;
       }
     case MENU_ID_FORGET:
       {
         mWifiManager.forget(mSelectedAccessPoint.networkId, mForgetListener);
         return true;
       }
     case MENU_ID_MODIFY:
       {
         showDialog(mSelectedAccessPoint, true);
         return true;
       }
   }
   return super.onContextItemSelected(item);
 }
  /* package */ void forget() {
    if (mSelectedAccessPoint.networkId == INVALID_NETWORK_ID) {
      // Should not happen, but a monkey seems to triger it
      Log.e(TAG, "Failed to forget invalid network " + mSelectedAccessPoint.getConfig());
      return;
    }

    mWifiManager.forget(mSelectedAccessPoint.networkId, mForgetListener);

    if (mWifiManager.isWifiEnabled()) {
      mScanner.resume();
    }
    updateAccessPoints();

    // We need to rename/replace "Next" button in wifi setup context.
    changeNextButtonState(false);
  }