[Resolved] native.setKeyboardFocus( nil) is not working at all

So I’m working on an app and when I call the “ended” phase of the keyboard to set the keyboard to nil, it doesn’t work at all. Is there a fix for this, I’ve looked at all the api’s and I’m following it to the letter. Thanks.

if "ended" == event.phase then native.setKeyboardFocus( nil) end [import]uid: 23649 topic_id: 26200 reply_id: 326200[/import]

Is this a situation where you should be using “submitted” rather than ended? http://developer.anscamobile.com/reference/index/nativesetkeyboardfocus

If not, could you explain a little more about what you are doing? It would be useful.

Peach :slight_smile: [import]uid: 52491 topic_id: 26200 reply_id: 106227[/import]

Yes, I was following that to letter (which wasn’t working) but I found a solution.

Thank you. [import]uid: 23649 topic_id: 26200 reply_id: 106232[/import]

I’ll mark as resolved then but perhaps you might share your solution for others in the future? :slight_smile:

Peach [import]uid: 52491 topic_id: 26200 reply_id: 106618[/import]

Here’s my solution:

[code]
local function onTouch(event)
if ( “began” == event.phase ) then
native.setKeyboardFocus( onTouch)
elseif ( “ended” == event.phase ) then
native.setKeyboardFocus( nil)
elseif ( “submitted” == event.phase ) then
native.setKeyboardFocus( nil)
end
end

[/code] [import]uid: 23649 topic_id: 26200 reply_id: 106638[/import]

Ah OK so you did add in submitted - great :slight_smile: (I misunderstood.)

Thank you for sharing your solution. [import]uid: 52491 topic_id: 26200 reply_id: 106651[/import]