Android Question InputDialog - Hiding The Keyboard After Use

RichardN

Active Member
Licensed User
I am using the Dialogs Library v4.01 for a simple, modal, string input.

In previous versions of Android the keyboard would either disappear naturally when the dialog was complete [Ok] or could be hidden with .HideKeyboard method using either the IME or Phone libraries.

On my S9 Oreo device the keyboard remains in view after the input dialog closes and none of the above methods works any more. The keyboard will hide with the 'Done' key but that requires yet another keystroke from the user.

Is there a cleaner solution?
 
Last edited:

walterf25

Expert
Licensed User
I am using the Dialogs Library v4.01 for a simple, modal, string input.

In previous versions of Android the keyboard would either disappear naturally when the dialog was complete [Ok] or could be hidden with .HideKeyboard method using either the IME or Phone libraries.

On my S9 Oreo device the keyboard remains in view after the input dialog closes and none of the above methods works any more. The keyboard will hide with the 'Done' key but that requires yet another keystroke from the user.

Is there a cleaner solution?
Try adding
B4X:
Sleep(100)
before you hide the keyboard.
Walter
 
Last edited:

RichardN

Active Member
Licensed User
@Walter...

I tried your suggestion:
B4X:
Sub HideKeyboard
        
        Phone.HideKeyboard(Activity).... 'or
        IME.HideKeyboard
        Sleep(100)
        
End Sub
In Oreo both methods work for the first call but fail to hide the keyboard for any subsequent calls.

@Erel... Thanks I'll give that dialog a go.
 

RichardN

Active Member
Licensed User
I have tried all the available Dialog codes, classes and libs on this forum. None of the others solves the problem of the keyboard remaining in view.

The code overhead of the cross-platform B4X class is overkill when it comes to fixing a simple problem such as this keyboard misbehavior of the internal dialog.

I am going back to the internal library and will live with the misbehaviour. Simple is good..... It's a great shame it does not work perfectly.
 
Last edited:

Computersmith64

Well-Known Member
Licensed User
@Walter...

I tried your suggestion:
B4X:
Sub HideKeyboard
       
        Phone.HideKeyboard(Activity).... 'or
        IME.HideKeyboard
        Sleep(100)
       
End Sub
In Oreo both methods work for the first call but fail to hide the keyboard for any subsequent calls.

@Erel... Thanks I'll give that dialog a go.
Call the Sleep BEFORE you try to hide the keyboard (& 50ms should be enough):

B4X:
Sleep(50)
IME.HideKeyboard
- Colin.
 

RichardN

Active Member
Licensed User
Erel, to be honest I did not try. I had already wasted too much unproductive time on it with simpler code solutions like Better Dialogs and had more important work to attend to.

I may revisit the issue later.
 

Harris

Expert
Licensed User
I had already wasted too much unproductive time on it
You are not alone here.... Effective keyboarding "hiding" has been an issue since day 1. Some days it works (odd days I think) and other times it's a time sucking issue that frustrates the heck out of you... no matter what you do! Like you state - works the first time - but often refuses to cooperate after that...
Let's hope Android Version 10 will have solved this....
 
Top