You should consider using android:imeOptions
if you only want to capture the Next key event.
Set this in your manifest as,
<EditText
android:id="@+id/search"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/search_hint"
android:inputType="text"
android:imeOptions="actionNext" />
and catch this in code calling setOnEditorActionListener() method on your EdiText
EditText editText = (EditText) findViewById(R.id.search);
editText.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
boolean handled = false;
if (actionId == EditorInfo.IME_ACTION_SEND) {
//do your stuff here
handled = true;
}
return handled;
}
});
There are whole bunch of other options. Do visit here.