1

I'm having a GLSurfaceView where I render my GUI. In one case I need the user to input a number, and to achieve this I'm using a FrameLayout with my GLSurfaceView on top and another dummy layout with an EditText behind it. When input is required I focus the EditText and force the soft keyboard to show. Then I listen for various ways to end the input, enter key, IME_ACTION_DONE, back-key etc.

However I just realized one case where this is not working. On some keyboards there is a "hide keyboard" button that does not send a keycode at all (some send a keycode-back from this key). The keyboard just closes and I can't determine that the input was done. And the EditText is still focused.

Is there any way to catch this event, or any other way to see if the keyboard was closed pƄ the user?

cmbellman
  • 303
  • 1
  • 10
  • I think you can check your view's onSizeChanged(). – Benito Bertoli Aug 17 '12 at 14:04
  • The view is a GLSurfaceView, and it is not and should not be changing size at all. The soft keyboard just appears on top of the view. Should I try to check the onSizeChanged anyway..? – cmbellman Aug 18 '12 at 09:46
  • My suggestion was based on [this answer](http://stackoverflow.com/a/3828646/1117415). But I have no experience with `GLSurfaceView`. Wouldn't hurt to try. – Benito Bertoli Aug 19 '12 at 12:31

1 Answers1

0

Sometimes you have to think outside the box.. I couldn't find any way to see if the keyboard was hidden by the user in some cases. And perhaps there is no way. So I started thinking about how this would work in a "normal" xml-layout with input fields etc. Because I never thought this was a problem then. The answer was simple. Those forms always has a "done", "save", "update" or similar button.

So.. I just ended up adding a button as an extra option for users to tell my app they finished the input. :)

cmbellman
  • 303
  • 1
  • 10