No event was triggered when the dismiss the keyboard button was pressed on Nexus 7.

Same issue here… Hope Corona can have a fix for this, so I can intercept ‘keyboard close’ events. 

Here is how i virtually solve it. May annoy some users, but this is the best that I can think of…

  1. Have a runtime listener, and always set keyboard focus on the native text field (native.setKeyboardFocus). I start this listener on event.phase = began.

  2. Only stop the runtime listener, if the text field event is ‘submits/done/ended’

Hi

The correct input field position is very basic requirement for a normal non-game app, if Corona SDK cannot provide their owned widget input in Android at this moment, as least SDK can provide as much key response as possible.

The keyboard dismissed or not is very important for programmer to put textfield or textbox in right position. Corona SDK should sent back the key response as much as possible.

There are several ways to dismiss keyboard such as : “Back” key, “V” key or like HTC series’ “square key” in HTC soft keyboard. (which can be found in attached image with red circle.)

I can get “Back” key response by [[Runtime:addEventListener( “key”, onKeyEvent )]], but I failed to get other key response.

According Google Android SDK seem to have solution for this issue, but it still need Coron Lab to implement it in corona sdk.

=============================================================================
public boolean onKeyPreIme (int keyCode, KeyEvent event)
Added in API level 3
 

Handle a key event before it is processed by any input method associated with the view hierarchy. This can be used to intercept key events in special situations before the IME consumes them; a typical example would be handling the BACK key to update the application’s UI instead of allowing the IME to see it and close itself.

 
Parameters keyCode The value in event.getKeyCode(). event Description of the key event.
 
Returns

    If you handled the event, return true. If you want to allow the event to be handled by the next receiver, return false.
 

Same issue here… Hope Corona can have a fix for this, so I can intercept ‘keyboard close’ events. 

Here is how i virtually solve it. May annoy some users, but this is the best that I can think of…

  1. Have a runtime listener, and always set keyboard focus on the native text field (native.setKeyboardFocus). I start this listener on event.phase = began.

  2. Only stop the runtime listener, if the text field event is ‘submits/done/ended’

Up!

We need an event when keyboard is dismissed!

Other android apps can do it properly.

As I’ve mentioned previously in this forum thread, there is no reliable means of knowing when the virtual keyboard is shown/hidden on Android.  It’s all handled by the operating system.

But that said, we *do* have an experimental API that you can enable in the “build.settings” file that will set up the app to be slid/panned by the operating system when the virtual keyboard is shown/hidden.  Have a look here for more details…

   http://forums.coronalabs.com/topic/50905-detect-keyboard-height/?p=272745

Well Joshua, I’ve put that on and it seems to work great so far on my device!

You guys gotta document this somewhere! Maybe in the textField API.

Are there any known issues about it? Aside from the status bar detail you mentioned there.

Thanks

On Android, the only other limitation that I’m aware of (other than the status bar) is that it *only* works for TextFields and TextBoxes.  It won’t work for text fields inside of WebViews.  Other than that, it seems pretty solid to me.  I just haven’t gotten much feedback from other Corona developers yet on it… but perhaps this is a case of no news is good news.  :slight_smile:

We currently have it flagged as experimental because our iOS equivalent of this setting has some limitations/issues that we haven’t had time work out yet.  Porting everything to 64-bit kept our iOS developers super busy in the past couple months.

Alright nice  :slight_smile:

Thanks again!

Up!

We need an event when keyboard is dismissed!

Other android apps can do it properly.

As I’ve mentioned previously in this forum thread, there is no reliable means of knowing when the virtual keyboard is shown/hidden on Android.  It’s all handled by the operating system.

But that said, we *do* have an experimental API that you can enable in the “build.settings” file that will set up the app to be slid/panned by the operating system when the virtual keyboard is shown/hidden.  Have a look here for more details…

   http://forums.coronalabs.com/topic/50905-detect-keyboard-height/?p=272745

Well Joshua, I’ve put that on and it seems to work great so far on my device!

You guys gotta document this somewhere! Maybe in the textField API.

Are there any known issues about it? Aside from the status bar detail you mentioned there.

Thanks

On Android, the only other limitation that I’m aware of (other than the status bar) is that it *only* works for TextFields and TextBoxes.  It won’t work for text fields inside of WebViews.  Other than that, it seems pretty solid to me.  I just haven’t gotten much feedback from other Corona developers yet on it… but perhaps this is a case of no news is good news.  :slight_smile:

We currently have it flagged as experimental because our iOS equivalent of this setting has some limitations/issues that we haven’t had time work out yet.  Porting everything to 64-bit kept our iOS developers super busy in the past couple months.

Alright nice  :slight_smile:

Thanks again!

Hi all,
I was trying to apply hidden rect method to dismiss the keyboard on tap. However the textbook seems not to propagate touch to the rect beneath it. What is the matter.
my code:
 

local hidRect local onHidRect = function(event) print("touch") native.setKeyboardFocus( nil ) hidRect:removeSelf( ) hidRect = nil return true end hidRect = display.newRect( x,y,W,H ) hidRect:setFillColor( 1,1,1,1 ) hidRect:addEventListener( "tap", onHidRect ) local function onTextBox( event ) if ( "began" == event.phase ) then print("began") native.setKeyboardFocus(textBox) elseif ("editing" ==event.phase) then texttosend = event.target.text elseif ( "submitted" == event.phase ) then ---or ("ended" == event.phase) then native.setKeyboardFocus( nil ) texttoSend = event.target.text end end

You cannot receive “touch” or “tap” events when the user touches native UI.  This is because native UI will steal the event for its own purposes.  This is actually how it works at the native UI level on *all* platforms (Apple, Google, and Microsoft).

What you can do instead is detect when a native TextField or TextBox receives/loses the focus.  You can detect this via the “began” and “ended” phases from a TextField/TextBox’s “userInput” events.

I see. I was playing with began and ended phases but still can’t achieve what I want. You see, upper part of the screen is the textbox and the lower is covered by the keyboard, so there is no empty space to move focus from the textbox. (there is the upper panel, but it is not intuitive at all from UX point of view to tap the panel when you want to dismiss the keyboard)

Have you considered leaving some space to tap outside the box?

On Android, users can dismiss the keyboard themselves via the Back key.  So, it’s less of an issue on this platform compared to iOS.  This is what Android users are used to.  Especially for low resolution screens which will show the TextBox fullscreen while it has the focus, which is much more common on phones when put into landscape mode.  Pressing the back key is typically the only way out in this scenario, which again, is normal for a native Android app.

Nah, on iPhone it doesn’t fit. I nevertheless solved this by creating a button “Done”.

Hi all,
I was trying to apply hidden rect method to dismiss the keyboard on tap. However the textbook seems not to propagate touch to the rect beneath it. What is the matter.
my code:
 

local hidRect local onHidRect = function(event) print("touch") native.setKeyboardFocus( nil ) hidRect:removeSelf( ) hidRect = nil return true end hidRect = display.newRect( x,y,W,H ) hidRect:setFillColor( 1,1,1,1 ) hidRect:addEventListener( "tap", onHidRect ) local function onTextBox( event ) if ( "began" == event.phase ) then print("began") native.setKeyboardFocus(textBox) elseif ("editing" ==event.phase) then texttosend = event.target.text elseif ( "submitted" == event.phase ) then ---or ("ended" == event.phase) then native.setKeyboardFocus( nil ) texttoSend = event.target.text end end