Skip to content

Instantly share code, notes, and snippets.

@baleen37
Created January 5, 2016 17:26
Show Gist options
  • Save baleen37/0eec41664ece6898051f to your computer and use it in GitHub Desktop.
Save baleen37/0eec41664ece6898051f to your computer and use it in GitHub Desktop.
class DoneOnEditorActionListener implements OnEditorActionListener {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
return true;
}
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment