Android: Hiding the keyboard in an overrided "Done" keypress of EditText
Posted
by Marshall Ward
on Stack Overflow
See other posts from Stack Overflow
or by Marshall Ward
Published on 2010-04-18T02:57:49Z
Indexed on
2010/04/18
3:03 UTC
Read the original article
Hit count: 361
Hello,
I have used a bit of Android code to override the "Done" button in my EditText field:
myEditField.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
mySubroutine();
return true;
}
return false;
}
});
Activating the field calls up the keyboard, and pressing "Done" evaluates mySubroutine() successfully. However, the keyboard no longer goes away when I press "Done". How do I restore this default behaviour to the routine?
© Stack Overflow or respective owner