TextView.OnEditorActionListener editListener =
(TextView view, int actionId, KeyEvent event) -> {
if (actionId == EditorInfo.IME_ACTION_NEXT) {
Toast.makeText(this, "next", Toast.LENGTH_SHORT).show();
}
if (actionId == EditorInfo.IME_ACTION_DONE) {
Toast.makeText(this, "done", Toast.LENGTH_SHORT).show();
}
return false;
};
editView.setOnEditorActionListener(editListener);
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId==EditorInfo.IME_ACTION_DONE){
//do something
}
return false;
}
});