Alain75
Member
I used IME HeightChanged to detect the display of the keyboard and place the input field upper the keyboard as mentionned it in an old post. It works well except when the smartphone turned off the screen because of standby. In that case, event returns a NewHeight greater than Height of the screen. So you need to test NewHeight versus min(OldHeight,100%y) :
100%y) instead
Above the log in the IDE : I touch the input field to display the keyboard, then touch to hide it, then wait the standby and finally turns it on :
@Erel, here is the code of a very simple test : just wait for the standby and then turns on screen to see the log.
HeightChanged Event:
Sub KBOARD_HeightChanged(NewHeight As Int, OldHeight As Int)
Log("100%y="&100%y& " New="&NewHeight&" Old="&OldHeight)
Dim kbaff As Boolean
kbaff = (NewHeight<OldHeight)
Log("KO : Keyboard "&IIf(kbaff,"shown","hidden"))
kbaff = (NewHeight<Min(OldHeight,100%y))
Log("OK : Keyboard "&IIf(kbaff,"shown","hidden"))
End Sub
Above the log in the IDE : I touch the input field to display the keyboard, then touch to hide it, then wait the standby and finally turns it on :
Logger connecté à : samsung SM-A405FN
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
** Activity (main) Resume **
100%y=1942 New=1017 Old=1942
KO : Keyboard shown
OK : Keyboard shown
100%y=1942 New=1942 Old=1017
KO : Keyboard hidden
OK : Keyboard hidden
** Activity (main) Pause, UserClosed = false **
Ignoring event: kboard_heightchanged
** Activity (main) Resume **
100%y=1942 New=1942 Old=2086
KO : Keyboard shown
OK : Keyboard hidden
@Erel, here is the code of a very simple test : just wait for the standby and then turns on screen to see the log.