I Have a Button which will do a bunch of Stuff when i type some numbers in an EditText.I want to know how to trigger this Button by simply pressing the "Enter" key. For now i only have an onClickListener which the user has to press once he has entered the data into the EditText.I want the Button to remain there and provide the user an additional option for proceeding further.
Can anyone help? The Code Below does nothing.When I press Enter on the Keyboard it just goes to the next line...
EditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)){
Button.performClick();
}
return false;
}
});