Keyboard wont go away when sending an email on Android

So I use the  native.showPopup(“mail”, options) to send an email.  After I send the keyboard does not disappear, and stays their and user has to exit game.  Would anyone have any idea how to fix this.  Does not happen on ios.  Thank you.

Take advantage of the resume event and force it to close:

local function sendEmail( to, subject, msg ) local closeMyKeyboard closeMyKeyboard = function ( event ) if event.type == "applicationResume" then print("Application resumed from suspension") Runtime:removeEventListener( "system", closeMyKeyboard ) native.setKeyboardFocus(nil) -- Closes keyboard end end Runtime:addEventListener( "system", closeMyKeyboard ) local options = { to = to, subject = subject, body = msg } native.showPopup( "mail", options ) end sendEmail( "john.doe@somewhere.com", "Problem Solved", "Got keyboard closing problems?" )

Full example of above here:

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/09/mail_keyboard_not_closing.zip

Hello, I think this questions was answered a couple days ago but i cant find the post… It says how to do this in the docs, I just searched “keyboard corona sdk” and it was the first thing that popped up…

Never worked with keyboards and textfeilds but the docs say all you have to do is nill it when your done…

native.setKeyboardFocus( nil )

Good Luck!

@roaminggamer  thank you that is brilliant idea and it makes sense!  

@SonicX278 thanks yes that was me in the forum a few days ago,  no one answered me as to how to fire off native.setKeyboardFocus( nil )

 but now I know :slight_smile:

Take advantage of the resume event and force it to close:

local function sendEmail( to, subject, msg ) local closeMyKeyboard closeMyKeyboard = function ( event ) if event.type == "applicationResume" then print("Application resumed from suspension") Runtime:removeEventListener( "system", closeMyKeyboard ) native.setKeyboardFocus(nil) -- Closes keyboard end end Runtime:addEventListener( "system", closeMyKeyboard ) local options = { to = to, subject = subject, body = msg } native.showPopup( "mail", options ) end sendEmail( "john.doe@somewhere.com", "Problem Solved", "Got keyboard closing problems?" )

Full example of above here:

http://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2015/09/mail_keyboard_not_closing.zip

Hello, I think this questions was answered a couple days ago but i cant find the post… It says how to do this in the docs, I just searched “keyboard corona sdk” and it was the first thing that popped up…

Never worked with keyboards and textfeilds but the docs say all you have to do is nill it when your done…

native.setKeyboardFocus( nil )

Good Luck!

@roaminggamer  thank you that is brilliant idea and it makes sense!  

@SonicX278 thanks yes that was me in the forum a few days ago,  no one answered me as to how to fire off native.setKeyboardFocus( nil )

 but now I know :slight_smile: