Please tell me, is it possible to force the click on IME_ACTION_NONE for the EditText to work? Can someone tell me why it does not work?

edit_text.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_NONE) { try { Toast.makeText(MainActivity.act_context, "test", Toast.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); } return true; } return false; } }); 

    1 answer 1

    As I recall, IME_ACTION_NONE does not trigger the listener. Create your id to handle the event. Put some id in resources

     <integer name="ime_action_id">666</integer> 

    Now in the EditText markup

     android:imeActionId="@integer/ime_action_id" 

    and in the code

     @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event){ if (actionId == getResources.getInteger(R.integer.ime_action_id)) { return true } else return false }