I can't find anything about the thing i need.
When the user is typing his stuff in the editText
he has to press a button
to perform a task. What i want to do is that when he presses Enter on the keyboard, it would be equivalent to the button task.
Asked
Active
Viewed 211 times
0

Dawid
- 585
- 5
- 26
1 Answers
0
You need to use and EditiorActionListener
editBox.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) {
//button action}
return false;
}
});

Anshul
- 387
- 3
- 15