Here i have used both of them , 
First is for Enter Key to do some task while click on Enter.
  <EditText android:imeOptions="actionDone"
        android:inputType="text"/> 
    editText.setOnKeyListener(new OnKeyListener()
    {
        public boolean onKey(View v, int keyCode, KeyEvent event)
        {
            if (event.getAction() == KeyEvent.ACTION_DOWN)
            {
                switch (keyCode)
                {
                    case KeyEvent.KEYCODE_DPAD_CENTER:
                    case KeyEvent.KEYCODE_ENTER:
                        addCourseFromTextBox();
                        return true;
                    default:
                        break;
                }
            }
            return false;
        }
    });
Second is for Search key to search some text.
<EditText android:imeOptions="actionSearch" 
    android:inputType="text"/> 
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_SEARCH) {
            performSearch();
            return true;
        }
        return false;
    }
});
Check out all imeOptions  in detail.