MOHAMED
MOHAMED

Reputation: 43518

Use "OK" key on softkeyboard (numberPassword keyboard) instead of clicking button?

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.

enter image description here

How can I realize that?

Upvotes: 0

Views: 626

Answers (2)

nbumakov
nbumakov

Reputation: 140

 mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        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);

Upvotes: 1

Chirag Savsani
Chirag Savsani

Reputation: 6140

Give some proper explanation...!!!
use Toast Message to know Action is performed or Not.

Upvotes: 0

Related Questions