Hide password on settings screen

I solved the issue using OnPreferenceChangeListener which is called before the preference is displayed and when it is changed. I take the opportunity then to set a modified version of the password in the summary, by converting the text to string with stars

Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
    @Override
    public boolean onPreferenceChange(Preference preference, Object value) {
        String stringValue = value.toString();
        ...
        if (preference instanceof EditTextPreference){
            // For the pin code, set a *** value in the summary to hide it
            if (preference.getContext().getString(R.string.pref_pin_code_key).equals(preference.getKey())) {
                stringValue = toStars(stringValue);
            }
            preference.setSummary(stringValue);
        }
        ...
        return true;
    }
};

String toStars(String text) {
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < text.length(); i++) {
        sb.append('*');
    }
    text = sb.toString();
    return text;

}

thank you all, currently I used "hotfix", which hide value of password. I will try replace it in the future. Hotfix is, that I simply remove showing of password:

bindPreferenceSummaryToValue(findPreference("username"));
//bindPreferenceSummaryToValue(findPreference("password"));
bindPreferenceSummaryToValue(findPreference("ip"));
bindPreferenceSummaryToValue(findPreference("port"));