EditText editText = findViewById(R.id.editText); editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { if (actionId == EditorInfo.IME_ACTION_SEND) { // Perform your action here return true; } return false; } });This example uses setOnEditorActionListener method on an EditText view, which listens for the 'Enter' key press. Once the user presses the SEND button on their keyboard, it triggers the defined action inside the onEditorAction method. The package library for EditText class is 'android.widget'.