0

I want my InputMethodService to switch to capitals when the cursor is positioned after a period ('.') and spaces. The trick is to get notified when the cursor is re-positioned. The cursor may get positioned after a period when either:

  1. user inputs period, or
  2. user touches the screen, or
  3. user pastes some text.

Question: how do I get the InputMethodService notified of selection changes and text pasting?

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127

1 Answers1

0

There is InputMethodService.onUpdateSelection (int oldSelStart, int oldSelEnd, int newSelStart, int newSelEnd, int candidatesStart, int candidatesEnd) that does the trick.

You could try to find something like that in InputConnection (like I did), but there's no InputConnection.getSelection() or InputConnection.onSelectionChanged().

18446744073709551615
  • 16,368
  • 4
  • 94
  • 127