Question: I have an EditText with the ImeOptions set to EditorInfo.IME\_ACTION\_NEXT. So the "Next" button is displayed on the keyboard when the field is focused. 
I want the button to change for "Done" WHILE the user is typing (for some reasons).
So I have a TextWatcher and I try to change the ImeOptions to EditorInfo.IME\_ACTION\_DONE on "afterTextChanged" but the key on the keyboard doesn't change.
I tried to hide the keyboard, change the ImeOptions and show the keyboard again but it doesn't work (this solution works for iOS).

Does someone know how to do that?

Answer: 
I tried this and it works, the problem is that you can sometime see when the keyboard appears and disappears.

```
@Override
public void afterTextChanged(Editable s) {

    if (/*condition*/) {

        // Change the IME of the current focused EditText
        editText.setImeOptions(EditorInfo.IME_ACTION_DONE);

        // Hide the keyboard
        hideKeyboard(activity);

        // Restart the input on the current focused EditText
        InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.restartInput(editText);

        // Show the keyboard
        showKeyboard(activity);
    }
}

```
From the answers above:

```
// Restart the input on the current focused EditText
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.restartInput(editText);

```

Only restarting the input does the trick. Otherwise, presumeably keyboard flickering is to be expected. Input restart also doesn't clear the field's contents i.e. doesn't lead to data loss, which is the desired behavior.