Home > DeveloperSection > Forums > How to use “OK” key on softkeyboard (numberPassword keyboard) instead of clicking button?
Sanjay Sharma
Sanjay Sharma

Total Post:45

Posted on    January-23-2015 10:12 PM

 Mobile Development Android  Java 

 1 Reply(s)
 541  View(s)
Rate this:

I have an EditText which InputType is numberPassword, and a Button"ANYNAME". I'd like to use "OK" key on softkeyboard (numeric keyboard) instead of the Button"ANYNAME" to execute a giving function in my code.

How can I realize that?

Andrew Watson
Andrew Watson

Total Post:39

Posted on    January-23-2015 10:30 PM

mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {


        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {

            // call some function

            return false;



if you want to change "Done" button title, use:

mEditText.setImeActionLabel("OK", KeyEvent.KEYCODE_ENTER);

Don't want to miss updates? Please click the below button!

Follow MindStick