edittext.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
//Enter key Action
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
//Press Enter to process
return true;
}
return false;
}
});
Do it like this.
© 2024 OneMinuteCode. All rights reserved.