code: private void adaptWizardButtonVisibilities() {
          if (buttonBar != null && backButton != null && nextButton != null && finishButton != null &&
                  navigationFragment != null) {
              int selectedNavigationPreferenceIndex =
                      navigationFragment.getSelectedNavigationPreferenceIndex();
  
              if (selectedNavigationPreferenceIndex != -1 && isButtonBarShown()) {
                  int navigationPreferenceCount = navigationFragment.getNavigationPreferenceCount();
                  backButton.setVisibility(
                          (selectedNavigationPreferenceIndex != 0) ? View.VISIBLE : View.GONE);
                  nextButton.setVisibility(
                          (selectedNavigationPreferenceIndex != navigationPreferenceCount - 1) ?
                                  View.VISIBLE : View.GONE);
                  finishButton.setVisibility(
                          (selectedNavigationPreferenceIndex == navigationPreferenceCount - 1) ?
                                  View.VISIBLE : View.GONE);
              } else if (isButtonBarShown()) {
                  backButton.setVisibility(View.GONE);
                  nextButton.setVisibility(View.GONE);
                  finishButton.setVisibility(View.VISIBLE);
              }
          }
      }
docs: Adapts the visibilities of the buttons of the button bar which is shown, when the activity is
  used as a wizard, depending on the currently selected navigation preference.