I have an Edit Text that is defined as follows.
You want a combination of android:imeOptions and setOnEditorActionListener
some_edittext.setOnEditorActionListener(new OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEND) {
some_button.performClick();
return true;
}
return false;
}
});
Obviously you should change actionSend to the action you want, and update IME_ACTION_SEND correspondingly.