2

I want to trigger an event when the user clicks done button in android keyboard

For Example: In login activity when I enter the password and press done button at right bottom corner of keyboard it close the keyboard and then I press the login button. Instead of that when the user press done button in keyboard the authentication should happen.

Charuක
  • 12,953
  • 5
  • 50
  • 88

1 Answers1

2
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_DONE) {
            // do your stuff here
        }
        return false;
    }
});
Charuක
  • 12,953
  • 5
  • 50
  • 88