Hide keyboard for inactivity

Is there a way to hide the keyboard after the user has not had any activity?

For example, after 10 seconds of not using the keyboard, it closes automatically or hides, or if the user has not touched the touch screen after 10 seconds, the keyboard will be hidden if it is open.

Any way to do it ?. In general I need to detect when a user stops having activity on the keyboard or on the touch screen to activate or deactivate a clock that will be responsible for closing it after 10 seconds or more.

1 Like

Hello, try creating a logic using text changed.

Initialize a variableT to 0, then when text got focus, set timer enable to true. (Interval= 1 second)
Then when text changes, set that variable to 0. This shows that the user is active.
Each time the timer fire,
Do: if variableT = 10 (or the amount you want to)
Then hide keyboard
Else: if variableT is less than 10
The: add 1 to the variableT

There is a block to hide keyboard…
@imanco
lIMG_20200212_091927

First you set the Timer enabled to false:

01

Then In each Text Box you can activate the clock and after 10 seconds the keyboard will be hidden.

02

I have not tried it, but in theory: wouldn’t it cause the keyboard to hide every 10 seconds even if the user is typing?

It’s true.
What you could do is use the OnTextChanged block
03

I’m in class now, I try to test it and should work.

1 Like

I appreciate you sharing your solutions. But I am not using a TextBox, but an HTML text editor. So I would not know yet to detect inactivity in the html text editor. Of course, the first one already gave me an idea to verify if the text has changed, but for her it would be necessary to create an invisible text, where what has been written in the text editor html is stored, and verify if the text, in the label , has changed every 3 or 5 seconds, and so, if it has not changed, activate the clock of 10 seconds or more that will be responsible for hiding the keyboard. But even so, personally, even if it’s a good trick, I can’t imagine running out of memory having two open texts, both written in the html text editor, and the hidden label.

So I think they should implement a block in Kodular that detects user inactivity, such as when no more touch is detected on the screen, such as that the virtual keyboard has not been used.

You should have mentioned this from the beginning because now you’ve wasted users’ time unnecessarily

1 Like

You can use JavaScript’s setTimeout() function to schedule a change in the WebViewString 10s after keyboard inactivity, capture the event using Kodular’s WebViewString changed block and then hide the keyboard.

2 Likes

Sorry?. I think that “detecting user inactivity” is a very universal and required issue when applying. For two reasons … 1, show ads; 2, close or pause or save some activity that the user was doing and leave open.

So, if people say that I am talking about a “TextBox”, it is not because I have said it, I did not even mention it, but clearly because Kodular is very limited that it seems that the keyboard is only used here to fill in a TEXTBOX. …

Thank you, I will try to apply it. If you have an example it will help me a lot.

By the way, I found this …

I don’t know if it could be implemented in Activity Starter in any way.

Boban is right.

You don’t know how to express yourself or how to ask a question and Kodular is to blame. haha!

1 Like

This post was flagged by the community and is temporarily hidden.

1 Like

You should have more respect for the people who are trying to help you.

Where have I disrespected who has tried to help me?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.