private void scrollToCallback(final String baseKey, final String prefKey) {
        for (Fragment fragment : getSupportFragmentManager().getFragments()) {
            final PreferenceScreen prefScreen = ((PreferenceFragmentCompat) fragment).getPreferenceScreen();
            if (prefScreen != null && StringUtils.equalsIgnoreCase(prefScreen.getKey(), baseKey)) {
                final Preference pref = prefScreen.findPreference(prefKey);
                if (pref != null) {
                    ((PreferenceFragmentCompat) fragment).scrollToPreference(pref);
                    pref.setTitle(prepareDisplayString(this, (String) pref.getTitle(), (String) pref.getTitle()));
                }
            }
        }
    }
This method sets the fragment given by its base key,
and optionally starts scrolling to a preference identified by its key
main/src/main/java/cgeo/geocaching/settings/SettingsActivity.java