EditText password Visible Toggle - Android User Interface

Android examples for User Interface:EditText

Description

EditText password Visible Toggle

Demo Code


//package com.java2s;

import android.text.InputType;

import android.widget.EditText;

public class Main {

    public static void passwordVisibleToggle(EditText editText) {
        if (editText.getInputType() == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
            editText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD
                    | InputType.TYPE_CLASS_TEXT);
        } else {/* w w w .  j a va2s  .  c  o  m*/
            editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
        }
    }
}

Related Tutorials