Code example for EditTextPreference

Methods: getEditText

    public boolean onPreferenceClick(Preference preference){
            EditTextPreference pref = (EditTextPreference) preference;
            EditText field = pref.getEditText();
            // This informs the keyboard not to show up the autocomplete. 
            // Ensure that you have set this input type, otherwise users 
            // may complain that your application is saving their passwords. 
            // This gives us the masking that you see in your password fields 
            field.setTransformationMethod(new PasswordTransformationMethod());
        // We still return false so that the system will handle everything else. 
        // We just needed to ensure that if this preference is the password pref 
        // that it's properly protected from prying eyes. 
        return false; 
    protected void onPause() { 
Stop searching for code, let great code find you!  Add Codota to your java IDE