@Override
      public void onClick(DialogInterface dialog, int whichButton) {
        String newName = nameEdit.getText().toString().trim();
        AccountIndex newIndex = new AccountIndex(newName, user.getIssuer());
        if (!newIndex.getStrippedName().equals(user.getStrippedName())) {
          if (accountDb.findSimilarExistingIndex(newIndex) != null) {
            Toast.makeText(context, R.string.error_exists, Toast.LENGTH_LONG).show();
          } else {
            accountDb.rename(user, newName);
            dismissFirstAccountAddedNoticeDisplay();
            refreshView(true);
          }
        }
      }
Invoked when a context menu/action bar item is clicked/tapped.

@return {@code true} if the event was consumed, {@code false} otherwise.
java/com/google/android/apps/authenticator/AuthenticatorActivity.java