0

I'm working on a accessibility service that include an IME for Android. It's important to know that is not part of an application (activity, view, etc).

With a certain command, I want to stop writing on a editText when I type letters.

I use the inputConnection to send action to the editor for this behavior with the action: IME_ACTION_DONE

//Inside public class myIME extends InputMethodService

boolean res = false;
InputConnection inputCon = getCurrentInputConnection();
if (null != inputCon)
{
    res = inputCon.performEditorAction(EditorInfo.IME_ACTION_DONE);
    //res = true, action executed but wrong behavior
}

For a unknow reason, the behavior is that the focus will always go to the next element in the view like the behavior of IME_ACTION_NEXT.

Even if I do this, this will do the same:

inputCon.performEditorAction(987654321); //No existing action ID

The question is, why?

probitaille
  • 1,899
  • 1
  • 19
  • 37

1 Answers1

2

Did you try to add the following to your EditText inside the xml-File?
android:imeOptions="actionDone"
I have a Layout with multiple EditTexts and am using a custom keyboard. Calling "inputCon.performEditorAction(EditorInfo.IME_ACTION_DONE);" was my only way to hide the keyboard after entering text. The focus stays on the last edited EditText (blinking cursor, but no keyboard shown).

Patrick
  • 41
  • 4