Ok in my app I have a field for the user to input a number. I have the field set to only accept numbers. When the user clicks on the field it brings up the keyboard. On the
I copied the following code from AndroidStudio when you create a LoginActivity. I use the ime attributes
In your layout
In your Activity
editTextUnidades.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == R.id.cantidad || actionId == EditorInfo.IME_NULL) {
addDetalle(null);
return true;
}
return false;
}
});