Q:

Android default button and DONE on keyboard

I have an activity with the following structure
 - LinearLayout
  - EditText (Username)
  - EditText (Password)
  - Button (Login)

I want that when the user is focused on the second EditText, instead of displaying NEXT in the keyboard, it displays "DONE" or "GO" and by pressing it, the click event of my button is raised.
Is this possible?

A:

Yse, is possible, just use following code:
    mUserID.setImeOptions(mUserID.getImeOptions()|EditorInfo.IME_ACTION_NEXT);
    mUserPass.setImeOptions(mUserPass.getImeOptions()|EditorInfo.IME_ACTION_DONE);
    mUserPass.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView pView, int pActionId, KeyEvent pEvent) {
            if (pActionId == EditorInfo.IME_ACTION_DONE) {
                // Do something
                return true;
            }
            return false;
        }
    });

