I know this question is old, but I want to point out what worked for me.
I tried using the sample code from the Android Developers website (shown below), but it didn't work. So I checked the EditorInfo class, and I realized that the IME_ACTION_SEND integer value was specified as 0x00000004
.
Sample code from Android Developers:
editTextEmail = (EditText) findViewById(R.id.editTextEmail);
editTextEmail
.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_SEND) {
/* handle action here */
handled = true;
}
return handled;
}
});
So, I added the integer value to my res/values/integers.xml
file.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="send">0x00000004</integer>
</resources>
Then, I edited my layout file res/layouts/activity_home.xml
as follows
<EditText android:id="@+id/editTextEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:imeActionId="@integer/send"
android:imeActionLabel="@+string/send_label"
android:imeOptions="actionSend"
android:inputType="textEmailAddress"/>
And then, the sample code worked.